Code Writer
Level 3, 2026-06-04
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create two strings and join them together with a space between

Use: variables[1]
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 = 52, T = 10
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 14 and another side of 1. Calculate the length of the missing side.

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

Use: variables[1]

Test Using:
Y = [1], Q = [1]
Y = [1,2,3], Q = [3,2,1]
Y = [87,81,90], Q = [56,59,93]
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 10HP

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 = [71,57,76]
Create a list containing 2 colors

Use: variables[1]
Assume you have a non-empty list Q. Create a new variable that is equal to the first element in the list.

Use: variables[1]

Test Using:
Q = [1]
Q = ['a','b','c']
Q = [40,73,98]
Assume you have a list of numbers VAR. Create a new variable that is equal to sum of all the numbers in VAR.

Use: variables, loops[2]

Test Using:
VAR = []
VAR = [1,1]
VAR = [41,54,90]
Print each number from 4 to 8

Use: loops[2]