Code Writer
Level 3, 2026-06-11
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 22
Use: loops[2]
|
|
|
|
Assume you have a variable B. If B is smaller than 4 add 6 to it, otherwise subtract 4 from it
Use: variables, if[2]
|
|
|
Test Using: B = 0 B = 4 B = 10 |
Use a loop to add the numbers from 0 to 35
Use: variables, loops[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 area of the rectangle.
Use: variables[2]
|
|
|
Test Using: S = 16, T = 37 |
Create a list containing 2 colors
Use: variables[1]
|
|
|
|
Use a loop to print 90 lines with the numbers from 1 to 90 and each number times 18, separated by a commma.
For example, line 1 would be "1, 18", line 2 would be "2, 36",etc.
Use: variables, loops, str()[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 rectangle has sides of 3 and 5. Create variables for the sides of the shape and then calculate its perimeter
Use: variables[2]
|
|
|
|
|