Code Writer
Level 3, 2026-07-11
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Create a list containing 5 fruit and then print each one
Use: variables, loops[2]
|
|
|
|
Assume you have a list of numbers E. Write code to add up the numbers in the list that are bigger than 15
Use: variables, loops, if[3]
|
|
|
Test Using: E = [] E = [5,6,7,8,9,10,11,12,13,14,15] E = [27,50,87] |
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 = [32,85,17] |
Create a list containing 2 colors and then print each one
Use: variables, loops[2]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 158HP. Write code that works out how much damage you have taken and prints "Dead" if you are killed.
Use: variables, loops, if[3]
|
|
|
Test Using: attacks = [1] attacks = [50,50,50] attacks = [1,1,1] |
Assume you have a list of numbers Q. Print the 9th element of Q.
Use: variables[1]
|
|
|
Test Using: Q = [1,2,3,4,5,6,7,8,9,10] |
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Create a list containing 5 animals
Use: variables[1]
|
|
|
|
|