Code Writer
Level 3, 2026-03-11
Answers should be legal Python code, including indentation. Use the underscore _ to show a space.
Special functions: print(), range(), sqrt(), str()
A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 186HP. 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 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 = [17,76,26] |
Use a loop to create a string that has 24 "e" characters
Use: variables, loops[2]
|
|
|
|
Print each number from 0 to 15
Use: loops[2]
|
|
|
|
Use a loop to print the sum of the numbers from 9 to 29
Use: variables, loops[2]
|
|
|
|
Set two variables to different values then add them together
Use: variables[1]
|
|
|
|
Assume you have a list of numbers X. Create a new variable that is equal to sum of all the numbers in X.
Use: variables, loops[2]
|
|
|
Test Using: X = [] X = [1,1] X = [17,76,26] |
Assume you have a list E with at least 2 elements. Create a new variable that is equal to the first two elements added together.
Use: variables[1]
|
|
|
Test Using: E = ['a','b','c'] E = ['big','dog'] E = [32,23,64] |
|