Code Writer
Level 3, 2026-05-22
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 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 = [61,26,59] |
A right angled triangle has a hypotenuse (longest side, opposite the right angle) of 9 and another side of 1. Calculate the length of the missing side.
Use: variables, sqrt()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Create a list containing 5 animals
Use: variables[1]
|
|
|
|
Assume you have a variable Q. If Q is smaller than 9 add 2 to it, otherwise subtract 9 from it
Use: variables, if[2]
|
|
|
Test Using: Q = 0 Q = 9 Q = 10 |
Assume you have a list of numbers X. Print the 7th element of X.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,4,5,6,7,8,9,10] |
Print each number from 0 to 21
Use: loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 9 to 23
Use: variables, loops[2]
|
|
|
|
Use a loop to add the numbers from 5 to 20
Use: variables, loops[2]
|
|
|
|
|