Code Writer
Level 3, 2026-11-27
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set two variables to different values then add them together

Use: variables[1]
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 4HP
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 = [56,19,3]
Use a loop to print a list of numbers, including a line number on each line

Use: variables, loops, str()[2]
A triangle has sides of 5, 9 and 7. Create variables for the sides of the triangle and then calculate its perimeter.

Use: variables[2]
Print your first name

Use: [1]
Assume you have a list A with at least 2 elements. Create a new variable that is equal to the first two elements added together.

Use: variables[1]

Test Using:
A = ['a','b','c']
A = ['big','dog']
A = [57,84,37]
Assume you have a non-empty list E. Create a new variable that is equal to the first element in the list.

Use: variables[1]

Test Using:
E = [1]
E = ['a','b','c']
E = [26,10,63]
Use a loop to print 16 lines with a line number and the word "moo". For example, line 1 should be "1: moo", line 2 would be "2: moo", etc.

Use: variables, loops, str()[2]
Do the sum 27 / 66 and print the result

Use: [1]
Set a variable to one value then change that value

Use: variables[1]