Code Writer
Level 3, 2026-08-19
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Do the sum 50 - 63 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a list of numbers X. Print the 9th element of X.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,4,5,6,7,8,9,10] |
Assume you have a non-empty list F. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: F = [1] F = ['a','b','c'] F = [79,53,13] |
Assume you have a non-empty list of scores E for your math class. Calculate the range of the scores.
Use: variables, loops[3]
|
|
|
Test Using: E = [10] E = [1,2,3,4,5] E = [9,35,73] |
Use a loop to print 43 lines with the numbers from 1 to 43 and each number times 3, separated by a commma.
For example, line 1 would be "1, 3", line 2 would be "2, 6",etc.
Use: variables, loops, str()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Print each number from 1 to 21
Use: loops[2]
|
|
|
|
Assume you have a list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the perimeter of the square.
Use: variables[2]
|
|
|
Test Using: S = 42 |
|