Code Writer
Level 3, 2026-07-19
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 print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the area of the square.
Use: variables[2]
|
|
|
Test Using: S = 37 |
Use a loop to print the sum of the numbers from 3 to 14
Use: variables, loops[2]
|
|
|
|
Assume you have a variable Q. If Q is bigger than 7 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: Q = 0 Q = 5 Q = 10 |
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Assume you have 2 lists of numbers that are the same size: VAR and Q. Count how many times an element in VAR is bigger than the element in the same position in Q.
Use: variables, loops[2]
|
|
|
Test Using: VAR = [5], Q = [5] VAR = [1,2,3], Q = [3,2,1] VAR = [4,87,70], Q = [16,58,21] |
A rectangle has sides of 4 and 8. Create variables for the sides of the shape and then calculate its area
Use: variables[2]
|
|
|
|
Assume you have a list of numbers Y. Print the 10th element of Y.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,4,5,6,7,8,9,10] |
|