Code Writer
Level 3, 2026-02-23
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have two non-empty lists of numbers VAR and X. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: VAR = [1], X = [1] VAR = [1,2,3], X = [3,2,1] VAR = [77,2,11], X = [70,17,47] |
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 = [38,33,19] |
Print your first name
Use: [1]
|
|
|
|
Use a loop to print the average of the numbers from 6 to 20
Use: variables, loops[2]
|
|
|
|
Create a list containing 2 animals
Use: variables[1]
|
|
|
|
Assume you have a list of numbers VAR. Write code to count the number of times the number 80 appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: VAR = [80] VAR = [0,80,-1,80,99,80] VAR = [42,89,49] |
Use a loop to print the average of the numbers from 0 to 6
Use: variables, loops[2]
|
|
|
|
Use a loop to print 22 lines with the numbers from 1 to 22 and each number times 15, separated by a commma.
For example, line 1 would be "1, 15", line 2 would be "2, 30",etc.
Use: variables, loops, str()[2]
|
|
|
|
Use a loop to multiply the numbers from 1 to 34
Use: variables, loops[2]
|
|
|
|
|