Code Writer
Level 3, 2026-10-15
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a non-empty list of numbers E. Write code to find the smallest number in the list.
Use: variables, loops, if[2]
|
|
|
Test Using: E = [1,2,3] E = [3,2,1,0] E = [38,53,93] |
Set two variables to different strings then make a new variable that combines them with a "E" in between
Use: variables[1]
|
|
|
|
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 118HP. 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 variable A. If A is bigger than 6 print "big", otherwise print "small"
Use: variables, if[2]
|
|
|
Test Using: A = 0 A = 5 A = 10 |
Create a list containing 3 colors and then print each one
Use: variables, loops[2]
|
|
|
|
Assume you have 2 lists of numbers with 7 elements each: X and E. Add the 5th elements of the lists together.
Use: variables[1]
|
|
|
Test Using: X = [1,2,3,...,7], E = [1,2,3,...,7] |
Use a loop to print the sum of the numbers from 5 to 20
Use: variables, loops[2]
|
|
|
|
Do the sum 77 + 34 in code and store the result
Use: variables[1]
|
|
|
|
|