Code Writer
Level 3, 2026-05-29
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set a variable to one value then change that value

Use: variables[1]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 111HP. 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 a list variable LIST. Print each value in LIST.

Use: loops[2]

Test Using:
LIST = [1,2,3]
LIST = ['a','b',0]
LIST = []
Use a loop to add the numbers from 3 to 16

Use: variables, loops[2]
Assume you have a list of numbers F. Write code to add up the numbers in the list that are bigger than or equal to than 5

Use: variables, loops, if[3]

Test Using:
F = []
F = [5,6,7,8,9,10,11,12,13,14,15]
F = [46,93,36]
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the perimeter of the rectangle.

Use: variables[2]

Test Using:
S = 86, T = 80
Print each number from 0 to 32

Use: loops[2]