Code Writer
Level 3, 2026-05-25
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 A and Y. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: A = [1], Y = [1] A = [1,2,3], Y = [3,2,1] A = [28,34,6], Y = [65,91,41] |
Print each number from 0 to 45
Use: loops[2]
|
|
|
|
Assume you have a list of names, B. Write code to count the number of times the name "Edward" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [] B = ['Edward'] B = ['Edward','Octavian','Julie','Edward'] |
Use a loop to add the numbers from 7 to 33
Use: variables, loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 1 to 12
Use: variables, loops[2]
|
|
|
|
Assume you have two non-empty lists of numbers X and E. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: X = [1], E = [1] X = [1,2,3], E = [3,2,1] X = [28,34,6], E = [65,91,41] |
Use a loop to print the sum of the numbers from 2 to 22
Use: variables, loops[2]
|
|
|
|
Assume you have a non-empty list VAR. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: VAR = [1] VAR = ['b','a','c'] VAR = [44,61,86] |
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
|