Code Writer
Level 3, 2026-02-18
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Do the sum 25 / 36 and print the result
Use: [1]
|
|
|
|
Assume you have a variable Q. If Q is smaller than 6 add 9 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: Q = 0 Q = 6 Q = 10 |
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 109HP. 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] |
Print each number from 1 to 20
Use: loops[2]
|
|
|
|
Assume you have a list of numbers Q. Print the 8th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 14 and another side of 6. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Assume you have a list of letters VAR. Write code to count the number of times the letter "f" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: VAR = [] VAR = ['f','a','z'] VAR = ['f','f','f'] |
Do the sum 57 * 82 in code and store the result
Use: variables[1]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
|