Create a combat function that takes the player's current health and the amount of damage received, and returns the player's new health. Health can't be less than 0.
My code:
def combat(health, damage):
total = health - damage
if total == 0:
return None
elif total < 0:
return 0
elif total > 0:
return total
def combat(health, damage):
return max(0, health-damage)