A list contains numbers that are the amount of HP damage caused by a series of attacks. Your character starts with 111HP. 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 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 list of numbers F. Write code to add up the numbers in the list that are bigger than or equal to than 5
Use: variables, loops, if[3]
|
|
|
Test Using: F = [] F = [5,6,7,8,9,10,11,12,13,14,15] F = [46,93,36] |