Code Writer
Level 3, 2026-04-21
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a variable Q. If Q is smaller than 2 add 7 to it, otherwise subtract 3 from it

Use: variables, if[2]

Test Using:
Q = 0
Q = 2
Q = 10
Print each number from 1 to 15

Use: loops[2]
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 = [74,44,70]
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 = 62
Print your first name

Use: [1]
Set a variable to one value then change that value

Use: variables[1]
Assume you have two non-empty lists of numbers Q and E. Create a new variable that is equal to the first element of each list added together.

Use: variables[1]

Test Using:
Q = [1], E = [1]
Q = [1,2,3], E = [3,2,1]
Q = [35,61,78], E = [71,64,30]
Use a loop to print 89 lines with the numbers from 1 to 89 and each number times 20, separated by a commma. For example, line 1 would be "1, 20", line 2 would be "2, 40",etc.

Use: variables, loops, str()[2]
Print each number from 1 to 26

Use: loops[2]
Set two variables to different values then add them together

Use: variables[1]