Code Writer
Level 3, 2026-05-13
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 Z. Write code to count the number of times the number 4 appears in the list.

Use: variables, loops, if[2]

Test Using:
Z = [4]
Z = [0,4,-1,4,99,4]
Z = [15,63,9]
Assume you have a list of numbers X. Print the 8th element of X.

Use: variables[1]

Test Using:
X = [1,2,3,4,5,6,7,8,9,10]
Create two strings and join them together with a space between

Use: variables[1]
Use a loop to add the numbers from 0 to 14

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 = []
Print each number from 1 to 30

Use: loops[2]
Assume you have 2 lists of numbers with 5 elements each: Z and B. Add the 5th elements of the lists together.

Use: variables[1]

Test Using:
Z = [1,2,3,...,5], B = [1,2,3,...,5]
Assume you have a variable E. If E is smaller than 7 add 2 to it, otherwise subtract 2 from it

Use: variables, if[2]

Test Using:
E = 0
E = 7
E = 10
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 = 59