Code Writer
Level 3, 2026-04-06
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 55!

Use: variables, loops, str()[2]
Create two strings and join them together with a space between

Use: variables[1]
Assume you have a variable VAR. If VAR is smaller than 4 add 6 to it, otherwise subtract 7 from it

Use: variables, if[2]

Test Using:
VAR = 0
VAR = 4
VAR = 10
A triangle has sides of 8, 6 and 4. Create variables for the sides of the triangle and then calculate its perimeter.

Use: variables[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 list variable LIST. Count the number of items in LIST and print the result.

Use: loops, variables[2]

Test Using:
LIST = ['a','b','c']
LIST = [1,2,3,4,5,6]
LIST = []
Assume you have a list of numbers A. Write code to add up the numbers in the list that are smaller than or equal to than 10

Use: variables, loops, if[3]

Test Using:
A = []
A = [5,6,7,8,9,10,11,12,13,14,15]
A = [21,81,32]
Assume you have a non-empty list Q. Create a new variable that is equal to the first element in the list.

Use: variables[1]

Test Using:
Q = [1]
Q = ['a','b','c']
Q = [71,46,82]