Code Writer
Level 3, 2026-10-04
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print the sum of the numbers from 0 to 8

Use: variables, loops[2]
Use a loop to print 28 lines with the numbers from 1 to 28 and each number times 2, separated by a commma. For example, line 1 would be "1, 2", line 2 would be "2, 4",etc.

Use: variables, loops, str()[2]
Assume you have a variable F. If F is bigger than 6 print "big", otherwise print "small"

Use: variables, if[2]

Test Using:
F = 0
F = 5
F = 10
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 56!

Use: variables, loops, str()[2]
Assume you have two non-empty lists of numbers B and VAR. Create a new variable that is equal to the first element of each list added together.

Use: variables[1]

Test Using:
B = [1], VAR = [1]
B = [1,2,3], VAR = [3,2,1]
B = [93,75,7], VAR = [8,37,52]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 142HP. Write code that works out how much damage you have taken and prints "Dead" if you are killed.

Use: variables, loops, if[3]

Test Using:
attacks = [1]
attacks = [50,50,50]
attacks = [1,1,1]
Set two variables to different strings then make a new variable that combines them with a "G" in between

Use: variables[1]
Set two variables to different strings then make a new variable that combines them with a "e" in between

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

Use: variables[1]