Code Writer
Level 3, 2026-10-19
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
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 2HP
2 is a medium attack taking 6HP
3 is a strong attack taking 14HP

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 = [14,91,1]
Create a list containing 4 colors

Use: variables[1]
Use a loop to multiply the numbers from 1 to 55

Use: variables, loops[2]
Print a list of strings, including a line number on each line

Use: variables, loops, str()[2]
Assume you have a list of names, Z. Write code to count the number of times the name "Jenny" appears in the list.

Use: variables, loops, if[2]

Test Using:
Z = []
Z = ['Jenny']
Z = ['Jenny','Octavian','Max','Jenny']
Assume you have a list of numbers Z. Create a new variable that is equal to sum of all the numbers in Z.

Use: variables, loops[2]

Test Using:
Z = []
Z = [1,1]
Z = [27,18,64]
Write a loop that prints "dum" 67 times

Use: loops[2]
Assume you have 2 lists of numbers with 12 elements each: X and A. Add the 9th elements of the lists together.

Use: variables[1]

Test Using:
X = [1,2,3,...,12], A = [1,2,3,...,12]