Code Writer
Level 3, 2026-10-09
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 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 = [97,22,43] |
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 = 21, T = 15 |
Use a loop to print the average of the numbers from 0 to 1
Use: variables, loops[2]
|
|
|
|
Assume you have a variable Z. If Z is bigger than 8 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: Z = 0 Z = 5 Z = 10 |
Use a loop to print 54 lines with the numbers from 1 to 54 and each number times 9, separated by a commma.
For example, line 1 would be "1, 9", line 2 would be "2, 18",etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to print the sum of the numbers from 2 to 22
Use: variables, loops[2]
|
|
|
|
Use a loop to multiply the numbers from 1 to 50
Use: variables, loops[2]
|
|
|
|
Do the sum 98 * 60 in code and store the result
Use: variables[1]
|
|
|
|
|