Code Writer
Level 3, 2026-11-16
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 list of numbers Q. Print the 5th element of Q.

Use: variables[1]

Test Using:
Q = [1,2,3,4,5,6,7,8,9,10]
Assume you have a list of numbers Y. Write code to add up the numbers in the list that are bigger than or equal to than 16

Use: variables, loops, if[3]

Test Using:
Y = []
Y = [5,6,7,8,9,10,11,12,13,14,15]
Y = [50,69,57]
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 4HP
3 is a strong attack taking 8HP

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 = [35,25,96]
A triangle has sides of 9, 5 and 2. Create variables for the sides of the triangle and then calculate its perimeter.

Use: variables[2]
Assume you have a list of numbers A. Create a new variable that is equal to sum of all the numbers in A.

Use: variables, loops[2]

Test Using:
A = []
A = [1,1]
A = [31,5,23]
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the perimeter of the square.

Use: variables[2]

Test Using:
S = 97
Print a variable that contains your first name

Use: variables[1]
Set two variables to different strings then make a new variable that combines them with a "g" in between

Use: variables[1]