Code Writer
Level 3, 2026-09-09
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Use a loop to add the numbers from 2 to 19
Use: variables, loops[2]
|
|
|
|
Assume you have a variable E. If E is bigger than 2 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: E = 0 E = 5 E = 10 |
A rectangle has sides of 2 and 6. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Assume you have a list of numbers A. Create a new variable that is equal to sum of all the numbers in A.
Use: variables, loops[2]
|
|
|
Test Using: A = [] A = [1,1] A = [5,58,58] |
A triangle has sides of 8, 2 and 9. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 177HP. 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] |
Do the sum 52 + 26 in code and store the result
Use: variables[1]
|
|
|
|
|