Code Writer
Level 3, 2026-05-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 a hypotenuse (longest side, opposite the right angle) of 10 and another side of 3. Calculate the length of the missing side.

Use: variables, sqrt()[2]
Use a loop to print the sum of the numbers from 0 to 1

Use: variables, loops[2]
Print a variable that contains your first name

Use: variables[1]
Set a variable to one value then change that value

Use: variables[1]
Assume you have a list of numbers E. Write code to count how many numbers in the list are smaller than 4

Use: variables, loops, if[3]

Test Using:
E = []
E = [4,0,25]
E = [40,3,84]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 127HP. 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 letters B. Write code to count the number of times the letter "e" appears in the list.

Use: variables, loops, if[2]

Test Using:
B = []
B = ['e','a','z']
B = ['e','e','e']
Assume you have a list VAR with at least 2 elements. Create a new variable that is equal to the first two elements added together.

Use: variables[1]

Test Using:
VAR = ['a','b','c']
VAR = ['big','dog']
VAR = [98,60,54]