Code Writer
Level 3, 2026-06-17
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 of numbers B. Write code to count how many numbers in the list are smaller than or equal to than 5

Use: variables, loops, if[3]

Test Using:
B = []
B = [5,0,25]
B = [77,87,11]
Create two strings and join them together with a space between

Use: variables[1]
Print a variable that contains your first name

Use: variables[1]
Assume you have a list of numbers X. Write code to count the number of times the number 9 appears in the list.

Use: variables, loops, if[2]

Test Using:
X = [9]
X = [0,9,-1,9,99,9]
X = [41,28,68]
Assume you have a list of numbers Z. Write code to count the number of times the number 38 appears in the list.

Use: variables, loops, if[2]

Test Using:
Z = [38]
Z = [0,38,-1,38,99,38]
Z = [41,28,68]
Set a variable to one value then change that value

Use: variables[1]
A factorial of a number is all the numbers from 1 to that number multiplied together, so 4! = 1x2x3x4. Write code using a loop to calculate 88!

Use: variables, loops, str()[2]
Use a loop to print the sum of the numbers from 0 to 3

Use: variables, loops[2]
Do the sum 45 - 62 and print the result

Use: [1]