Code Writer
Level 3, 2026-03-26
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print the sum of the numbers from 8 to 24
Use: variables, loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 2 to 13
Use: variables, loops[2]
|
|
|
|
Use a loop to add the numbers from 0 to 32
Use: variables, loops[2]
|
|
|
|
Assume you have a variable X. If X is smaller than 7 add 3 to it, otherwise subtract 2 from it
Use: variables, if[2]
|
|
|
Test Using: X = 0 X = 7 X = 10 |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Use a loop to print the average of the numbers from 0 to 4
Use: variables, loops[2]
|
|
|
|
Assume you have two non-empty lists of numbers VAR and F. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: VAR = [1], F = [1] VAR = [1,2,3], F = [3,2,1] VAR = [50,60,14], F = [27,10,96] |
A right angled triangle has 2 shorter sides of 9 and 3. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Assume you have 2 lists of numbers with 20 elements each: X and VAR. Add the 10th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,...,20], VAR = [1,2,3,...,20] |
|