Code Writer
Level 3, 2026-06-30
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create a list containing 3 numbers
Use: variables[1]
|
|
|
|
Use a loop to print the average of the numbers from 8 to 20
Use: variables, loops[2]
|
|
|
|
Do the sum 27 * 42 in code and store the result
Use: variables[1]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
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 = [97,91,69] |
Use a loop to multiply the numbers from 1 to 18
Use: variables, loops[2]
|
|
|
|
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 = [] |
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 132HP. 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] |
|