Code Writer
Level 3, 2026-09-11
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 add the numbers from 0 to 11
Use: variables, loops[2]
|
|
|
|
A triangle has sides of 4, 2 and 6. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Use a loop to multiply the numbers from 1 to 25
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers that are the same size: Q and E. Count how many times an element in Q is bigger than or equal to the element in the same position in E.
Use: variables, loops[2]
|
|
|
Test Using: Q = [5], E = [5] Q = [1,2,3], E = [3,2,1] Q = [88,0,17], E = [36,21,52] |
Use a loop to print the sum of the numbers from 5 to 23
Use: variables, loops[2]
|
|
|
|
Assume you have a list B with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: B = ['a','b','c'] B = ['big','dog'] B = [80,99,58] |
Assume you have a non-empty list E. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: E = [1] E = ['b','a','c'] E = [5,27,25] |
Assume you have a list of names, B. Write code to count the number of times the name "Mike" appears in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [] B = ['Mike'] B = ['Mike','Flip','Flip','Mike'] |
Do the sum 29 + 64 in code and store the result
Use: variables[1]
|
|
|
|
|