Code Writer
Level 3, 2026-08-20
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a non-empty list Z. Print the first element in the list.

Use: variables[1]

Test Using:
Z = [1]
Z = ['b','a','c']
Z = [62,49,86]
Use a loop to print the sum of the numbers from 0 to 4

Use: variables, loops[2]
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 13 and another side of 5. Calculate the length of the missing side.

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 151HP. 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]
Print a variable that contains your first name

Use: variables[1]
Write a loop that prints "dumdum" 70 times

Use: loops[2]
Do the sum 64 - 56 in code and store the result

Use: variables[1]
Use a loop to print the average of the numbers from 7 to 18

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

Use: variables[1]

Test Using:
Q = [1], B = [1]
Q = [1,2,3], B = [3,2,1]
Q = [85,4,33], B = [94,63,65]