Code Writer
Level 3, 2026-02-21
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 multiply the numbers from 1 to 36

Use: variables, loops[2]
A list contains a series of attacks on an enemy. The list looks like [1,2,3,1,1,2,...] where each element in the list is a number that means a type of attack:

1 is a light attack, taking 1HP
2 is a medium attack taking 6HP
3 is a strong attack taking 17HP

Write code to calculate the total amount of HP damage caused by all the attacks.

Use: variables, loops, if[3]

Test Using:
attacks = [1,2,3]
attacks = [1,2,3,3,2,1]
attacks = [39,82,35]
Do the sum 21 + 42 and print the result

Use: [1]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 115HP. 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 of numbers Y. Write code to count the number of times the number 80 appears in the list.

Use: variables, loops, if[2]

Test Using:
Y = [80]
Y = [0,80,-1,80,99,80]
Y = [50,39,91]
Use a loop to print 51 lines with a line number and the word "bloop". For example, line 1 should be "1: bloop", line 2 would be "2: bloop", etc.

Use: variables, loops, str()[2]
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.

Use: variables[2]

Test Using:
S = 86