Code Writer
Level 3, 2026-12-01
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A right angled triangle has 2 shorter sides of 8 and 2. Calculate the other side (the "hypotenuse").

Use: variables, sqrt()[2]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 129HP. 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]
Use a loop to add the numbers from 5 to 32

Use: variables, loops[2]
Assume you have a variable B. If B is smaller than 2 add 5 to it, otherwise subtract 7 from it

Use: variables, if[2]

Test Using:
B = 0
B = 2
B = 10
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 103HP. 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]
Assume you have two non-empty lists of numbers X and VAR. Create a new variable that is equal to the first element of each list added together.

Use: variables[1]

Test Using:
X = [1], VAR = [1]
X = [1,2,3], VAR = [3,2,1]
X = [21,45,33], VAR = [18,90,85]
Use a loop to print a list of numbers, including a line number on each line

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