Code Writer
Level 3, 2026-08-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 the sum of the numbers from 0 to 2
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers F. Write code to add up the numbers in the list that are bigger than or equal to than 12
Use: variables, loops, if[3]
|
|
|
Test Using: F = [] F = [5,6,7,8,9,10,11,12,13,14,15] F = [97,7,23] |
Do the sum 25 / 77 and print the result
Use: [1]
|
|
|
|
Assume you have a list Z with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: Z = ['a','b','c'] Z = ['big','dog'] Z = [30,70,2] |
Assume you have a list of numbers B. Write code to count how many numbers in the list are smaller than or equal to than 14
Use: variables, loops, if[3]
|
|
|
Test Using: B = [] B = [14,0,25] B = [1,1,96] |
Assume you have a variable S that is the length of the side of a square. Calculate another variable that is equal to the perimeter of the square.
Use: variables[2]
|
|
|
Test Using: S = 95 |
Assume you have a list of numbers E. Write code to add up the numbers in the list that are bigger than or equal to than 12
Use: variables, loops, if[3]
|
|
|
Test Using: E = [] E = [5,6,7,8,9,10,11,12,13,14,15] E = [97,7,23] |
|