Code Writer
Level 3, 2026-04-27
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
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 = [8,71,25] |
A triangle has sides of 6, 4 and 3. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Use a loop to print the average of the numbers from 7 to 20
Use: variables, loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 8 to 19
Use: variables, loops[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 = [] |
Assume you have a list of numbers Y. Write code to add up the numbers in the list that are bigger than 14
Use: variables, loops, if[3]
|
|
|
Test Using: Y = [] Y = [5,6,7,8,9,10,11,12,13,14,15] Y = [48,96,79] |
|