Code Writer
Level 3, 2026-11-05
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set a variable to one value then change that value
Use: variables[1]
|
|
|
|
Assume you have a non-empty list of numbers A. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: A = [1,2,3] A = [3,2,1,0] A = [86,89,97] |
Assume you have a non-empty list of numbers Z. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: Z = [1,2,3] Z = [3,2,1,0] Z = [86,89,97] |
Use a loop to print the sum of the numbers from 0 to 2
Use: variables, loops[2]
|
|
|
|
Print a variable that contains your first name
Use: variables[1]
|
|
|
|
Assume you have a list variable LIST. Count the number of items in LIST.
Use: loops, variables[2]
|
|
|
Test Using: LIST = ['a','b','c'] LIST = [1,2,3,4,5,6] LIST = [] |
Do the sum 24 / 22 in code and store the result
Use: variables[1]
|
|
|
|
Assume you have 2 lists of numbers with 5 elements each: Y and B. Add the 5th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: Y = [1,2,3,...,5], B = [1,2,3,...,5] |
Set two variables to different strings then make a new variable that combines them with a "a" in between
Use: variables[1]
|
|
|
|
Use a loop to print the sum of the numbers from 0 to 9
Use: variables, loops[2]
|
|
|
|
|