Code Writer
Level 3, 2026-04-14
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 variable LIST of numbers. Use a variable to add the items in the list

Use: variables, loops[2]

Test Using:
LIST = [1]
LIST = [1,2,3,4,5,6,7,8,9]
LIST = [5,13,19]
Assume you have a list of names, E. Write code to count the number of times the name "Felix" appears in the list.

Use: variables, loops, if[2]

Test Using:
E = []
E = ['Felix']
E = ['Felix','Edward','Flip','Felix']
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 20!

Use: variables, loops, str()[2]
Assume you have a non-empty list of scores Y for your math class. Calculate the maximum of the scores.

Use: variables, loops[3]

Test Using:
Y = [10]
Y = [1,2,3,4,5]
Y = [77,25,84]
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 3HP
2 is a medium attack taking 6HP
3 is a strong attack taking 7HP

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 = [13,100,9]
Assume you have a variable F. If F is smaller than 8 add 2 to it, otherwise subtract 5 from it

Use: variables, if[2]

Test Using:
F = 0
F = 8
F = 10
Set two variables to different values then add them together

Use: variables[1]