Code Writer
Level 3, 2026-08-27
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 variable X. If X is smaller than 6 add 4 to it, otherwise subtract 3 from it

Use: variables, if[2]

Test Using:
X = 0
X = 6
X = 10
Print a variable that contains your first name

Use: variables[1]
Assume you have a list of numbers Q. Print the 10th element of Q.

Use: variables[1]

Test Using:
Q = [1,2,3,4,5,6,7,8,9,10]
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 87!

Use: variables, loops, str()[2]
Create a list containing 2 fruit

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

Use: variables, loops[2]
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 18HP

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 = [68,95,44]
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the area of the rectangle.

Use: variables[2]

Test Using:
S = 78, T = 87
Set two variables to different values then add them together

Use: variables[1]