Code Writer
Level 3, 2026-10-07
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 multiply the numbers from 4 to 14
Use: variables, loops[2]
|
|
|
|
Assume you have a non-empty list of numbers Q. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [1,2,3] Q = [3,2,1,0] Q = [5,76,30] |
Use a loop to print the average of the numbers from 0 to 8
Use: variables, loops[2]
|
|
|
|
A right angled triangle has 2 shorter sides of 5 and 7. Calculate the other side (the "hypotenuse").
Use: variables, sqrt()[2]
|
|
|
|
Assume you have a non-empty list E. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: E = [1] E = ['b','a','c'] E = [57,81,68] |
Assume you have a variable A. If A is smaller than 6 add 9 to it, otherwise subtract 7 from it
Use: variables, if[2]
|
|
|
Test Using: A = 0 A = 6 A = 10 |
Do the sum 35 / 81 and print the result
Use: [1]
|
|
|
|
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 90!
Use: variables, loops, str()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
|