Code Writer
Level 3, 2026-09-24
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Assume you have a non-empty list of numbers B. Write code to find the biggest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: B = [1,2,3] B = [3,2,1,0] B = [19,52,7] |
Print each number from 1 to 41
Use: loops[2]
|
|
|
|
Use a loop to print the average of the numbers from 9 to 20
Use: variables, loops[2]
|
|
|
|
Use a loop to print 61 lines with the numbers from 1 to 61 and each number times 3, separated by a commma.
For example, line 1 would be "1, 3", line 2 would be "2, 6",etc.
Use: variables, loops, str()[2]
|
|
|
|
A triangle has sides of 8, 6 and 9. Create variables for the sides of the triangle and then calculate its perimeter.
Use: variables[2]
|
|
|
|
Assume you have a non-empty list of scores Z for your math class. Calculate the minimum of the scores.
Use: variables, loops[3]
|
|
|
Test Using: Z = [10] Z = [1,2,3,4,5] Z = [34,38,25] |
Do the sum 54 - 81 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have two non-empty lists of numbers A and B. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: A = [1], B = [1] A = [1,2,3], B = [3,2,1] A = [88,62,79], B = [38,91,17] |
|