Code Writer
Level 3, 2026-05-30
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print each number from 0 to 38
Use: loops[2]
|
|
|
|
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a variable VAR. If VAR is smaller than 5 add 7 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: VAR = 0 VAR = 5 VAR = 10 |
Assume you have a list of numbers VAR. Create a new variable that is equal to sum of all the numbers in VAR.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [] VAR = [1,1] VAR = [35,29,52] |
A triangle has sides of 5, 6 and 3. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have a non-empty list of numbers VAR. Create a new variable that is equal all the numbers in VAR multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [1,1] VAR = [1,2,3,4,5] VAR = [77,56,31] |
Assume you have a variable E. If E is smaller than 8 add 4 to it, otherwise subtract 3 from it
Use: variables, if[2]
|
|
|
Test Using: E = 0 E = 8 E = 10 |
|