Code Writer
Level 3, 2025-12-17
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 27
Use: variables, loops[2]
|
|
|
|
Do the sum 28 - 36 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have a list of numbers E. Create a new variable that is equal to sum of all the numbers in E.
Use: variables, loops[2]
|
|
|
Test Using: E = [] E = [1,1] E = [68,76,8] |
Use a loop to print 86 lines with the numbers from 1 to 86 and each number times 20, separated by a commma.
For example, line 1 would be "1, 20", line 2 would be "2, 40",etc.
Use: variables, loops, str()[2]
|
|
|
|
Set two variables to different strings then make a new variable that combines them with a "C" in between
Use: variables[1]
|
|
|
|
Assume you have a non-empty list of numbers X. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: X = [1,2,3] X = [3,2,1,0] X = [83,85,22] |
Use a loop to print the sum of the numbers from 4 to 16
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 13 elements each: A and Z. Add the 4th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: A = [1,2,3,...,13], Z = [1,2,3,...,13] |
Create two strings and join them together with a space between
Use: variables[1]
|
|
|
|
Assume you have two non-empty lists of numbers X and F. Create a new variable that is equal to the first element of each list added together.
Use: variables[1]
|
|
|
Test Using: X = [1], F = [1] X = [1,2,3], F = [3,2,1] X = [45,51,51], F = [89,17,30] |
|