Code Writer
Level 3, 2026-03-25
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 58 lines with the numbers from 1 to 58 and each number times 18, separated by a commma.
For example, line 1 would be "1, 18", line 2 would be "2, 36",etc.
Use: variables, loops, str()[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a list of numbers Q. Create a new variable that is equal to sum of all the numbers in Q.
Use: variables, loops[2]
|
|
|
Test Using: Q = [] Q = [1,1] Q = [6,22,73] |
Create a list containing 4 numbers and then print each one
Use: variables, loops[2]
|
|
|
|
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Do the sum 30 / 26 and print the result
Use: [1]
|
|
|
|
A right angled triangle has 2 shorter sides of 2 and 8. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
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 = [0,76,2] |
Assume you have 2 variables S and T that are equal to the sides of a rectangle. Calculate another variable that is equal to the area of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 67, T = 95 |
|