Code Writer
Level 3, 2026-02-15
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 of scores Y for your math class. Calculate the mean of the scores.

Use: variables, loops[3]

Test Using:
Y = [10]
Y = [1,2,3,4,5]
Y = [65,21,81]
Assume you have a list variable LIST. Count the number of items in LIST.

Use: loops, variables[2]

Test Using:
LIST = ['a','b','c']
LIST = [1,2,3,4,5,6]
LIST = []
Assume you have a non-empty list E. Print the first element in the list.

Use: variables[1]

Test Using:
E = [1]
E = ['b','a','c']
E = [45,80,95]
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 5HP
3 is a strong attack taking 13HP

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 = [2,84,97]
Do the sum 38 - 36 in code and store the result

Use: variables[1]
Do the sum 63 / 70 and print the result

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

Use: variables[1]
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 130HP. 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]