Code Writer
Level 3, 2026-05-12
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 variable E. If E is smaller than 9 add 9 to it, otherwise subtract 6 from it
Use: variables, if[2]
|
|
|
Test Using: E = 0 E = 9 E = 10 |
Use a loop to multiply the numbers from 2 to 14
Use: variables, loops[2]
|
|
|
|
Create a list containing 5 colors and then print each one
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 a list variable LIST. Print each value in LIST.
Use: loops[2]
|
|
|
Test Using: LIST = [1,2,3] LIST = ['a','b',0] LIST = [] |
Assume you have a non-empty list VAR. Create a new variable that is equal to the first element in the list.
Use: variables[1]
|
|
|
Test Using: VAR = [1] VAR = ['a','b','c'] VAR = [67,6,79] |
Assume you have a list variable LIST of numbers. Use a variable to add the items in the list
Use: variables, loops[2]
|
|
|
Test Using: LIST = [1] LIST = [1,2,3,4,5,6,7,8,9] LIST = [43,52,15] |
Assume you have a variable VAR. If VAR is smaller than 3 add 2 to it, otherwise subtract 2 from it
Use: variables, if[2]
|
|
|
Test Using: VAR = 0 VAR = 3 VAR = 10 |
|