Code Writer
Level 3, 2026-08-03
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create a list containing 4 numbers and then print each one
Use: variables, loops[2]
|
|
|
|
Use a loop to multiply the numbers from 3 to 20
Use: variables, loops[2]
|
|
|
|
Print each number from 9 to 23
Use: loops[2]
|
|
|
|
A triangle has sides of 4, 3 and 3. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
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 non-empty list of numbers B. Create a new variable that is equal all the numbers in B multiplied together.
Use: variables, loops[2]
|
|
|
Test Using: B = [1,1] B = [1,2,3,4,5] B = [17,36,26] |
Assume you have a non-empty list of numbers Q. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Q = [1,2,3] Q = [3,2,1,0] Q = [13,4,85] |
Assume you have a list X with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: X = ['a','b','c'] X = ['big','dog'] X = [84,75,51] |
|