반응형
Create a combat function that takes the player's current health and the amount of damage recieved, and returns the player's new health. Health can't be less than 0.
Solution:
def combat(health, damage):
return max(health-damage, 0)
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
0930. Count of positives, sum of negatives (0) | 2022.09.30 |
---|---|
0929. Summing a number's digits (0) | 2022.09.29 |
0927. Opposites Attract (0) | 2022.09.27 |
0926. Merge two sorted arrays into one (0) | 2022.09.26 |
0925. Thinkful - Logic Drills: Traffic light (0) | 2022.09.25 |