Code Writer
Level 3, 2026-07-14
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 = [13,97,58] |
Use a loop to print the sum of the numbers from 4 to 19
Use: variables, loops[2]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST and print the result.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
A right angled triangle has 2 shorter sides of 5 and 4. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[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 perimeter of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 81, T = 96 |
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Do the sum 74 * 79 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a variable X. If X is smaller than 7 add 8 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: X = 0 X = 7 X = 10 |
|