Code Writer
Level 3, 2026-04-10
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have 2 lists of numbers that are the same size: E and A. Count how many times an element in E is equal to the element in the same position in A.
Use: variables, loops[2]
|
|
|
Test Using: E = [5], A = [5] E = [1,2,3], A = [3,2,1] E = [51,24,61], A = [34,64,26] |
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [25,66,24] |
Use a loop to print the average of the numbers from 0 to 3
Use: variables, loops[2]
|
|
|
|
Print each number from 0 to 20
Use: loops[2]
|
|
|
|
Assume you have a list of numbers Z. Write code to count the number of times the number 29 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Z = [29] Z = [0,29,-1,29,99,29] Z = [2,9,12] |
Use a loop to print 85 lines with the numbers from 1 to 85 and each number times 8, separated by a commma.
For example, line 1 would be "1, 8", line 2 would be "2, 16",etc.
Use: variables, loops, str()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Create a list containing 3 numbers
Use: variables[1]
|
|
|
|
|