Code Writer
Level 3, 2026-11-18
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 list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the perimeter of the square.
Use: variables[2]
|
|
|
Test Using: S = 50 |
Use a loop to print the average of the numbers from 0 to 2
Use: variables, loops[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
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 = [] |
Do the sum 33 + 64 and print the result
Use: [1]
|
|
|
|
Assume you have a non-empty list of numbers A. Write code to find the biggest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: A = [1,2,3] A = [3,2,1,0] A = [9,94,44] |
Create a list containing 3 numbers
Use: variables[1]
|
|
|
|
|