Code Writer
Level 3, 2026-12-04
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Do the sum 74 + 65 and print the result
Use: [1]
|
|
|
|
Do the sum 87 * 77 and print the result
Use: [1]
|
|
|
|
Use a loop to multiply the numbers from 6 to 26
Use: variables, loops[2]
|
|
|
|
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 = 73 |
Assume you have a list Y with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: Y = ['a','b','c'] Y = ['big','dog'] Y = [62,48,13] |
Assume you have a non-empty list Q. Print the first element in the list.
Use: variables[1]
|
|
|
Test Using: Q = [1] Q = ['b','a','c'] Q = [91,25,13] |
Assume you have a non-empty list of numbers B. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [1,2,3] B = [3,2,1,0] B = [64,21,35] |
Use a loop to multiply the numbers from 7 to 18
Use: variables, loops[2]
|
|
|
|
Use a loop to print a list of numbers, including a line number on each line
Use: variables, loops, str()[2]
|
|
|
|
Assume you have 2 lists of numbers with 9 elements each: E and Z. Add the 6th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: E = [1,2,3,...,9], Z = [1,2,3,...,9] |
|