Code Writer
Level 3, 2026-09-12
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 1 to 21
Use: loops[2]
|
|
|
|
Assume you have a non-empty list of numbers Z. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Z = [1,2,3] Z = [3,2,1,0] Z = [46,5,88] |
Use a loop to print the average of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
Assume you have a variable VAR. If VAR is bigger than 8 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: VAR = 0 VAR = 5 VAR = 10 |
Create a list containing 4 colors and then print each one
Use: variables, loops[2]
|
|
|
|
A rectangle has sides of 6 and 9. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
A rectangle has sides of 4 and 4. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
Assume you have a list of numbers VAR. Print the 6th element of VAR.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,4,5,6,7,8,9,10] |
|