Code Writer
Level 3, 2026-07-27
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 60!

Use: variables, loops, str()[2]
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 28!

Use: variables, loops, str()[2]
Assume you have a variable Y. If Y is smaller than 7 add 6 to it, otherwise subtract 4 from it

Use: variables, if[2]

Test Using:
Y = 0
Y = 7
Y = 10
Use a loop to print 21 lines with a line number and the word "error". For example, line 1 should be "1: error", line 2 would be "2: error", etc.

Use: variables, loops, str()[2]
Assume you have a list of names, Z. Write code to count the number of times the name "Mike" appears in the list.

Use: variables, loops, if[2]

Test Using:
Z = []
Z = ['Mike']
Z = ['Mike','Edward','Max','Mike']
Set two variables to different values then add them together

Use: variables[1]
Assume you have a list variable LIST. Count the number of items in LIST.

Use: loops, variables[2]

Test Using:
LIST = ['a','b','c']
LIST = [1,2,3,4,5,6]
LIST = []
Print a list of strings, including a line number on each line

Use: variables, loops, str()[2]