Code Writer
Level 3, 2026-05-22
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Use a loop to print 30 lines with the numbers from 1 to 30 and each number times 12, separated by a commma.
For example, line 1 would be "1, 12", line 2 would be "2, 24",etc.
Use: variables, loops, str()[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 6 to 26
Use: variables, loops[2]
|
|
|
|
Print your first name
Use: [1]
|
|
|
|
Assume you have a list of numbers Y. Write code to count the number of times the number 69 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Y = [69] Y = [0,69,-1,69,99,69] Y = [20,49,11] |
Assume you have a variable Q. If Q is bigger than 7 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: Q = 0 Q = 5 Q = 10 |
Assume you have two non-empty lists of numbers Z and A. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: Z = [1], A = [1] Z = [1,2,3], A = [3,2,1] Z = [70,98,83], A = [0,49,12] |
Assume you have a list of numbers Q. Write code to count how many numbers in the list are smaller than or equal to than 3
Use: variables, loops, if[3]
|
|
|
Test Using: Q = [] Q = [3,0,25] Q = [70,11,2] |
Assume you have a list of numbers VAR. Print the 5th element of VAR.
Use: variables[1]
|
|
|
Test Using: VAR = [1,2,3,4,5,6,7,8,9,10] |
|