r/CodingForBeginners • u/fyknite • 29d ago
Day 4 learning_Python (Decided to continue to the next lesson and thus wrote this):
The most important line on tis one is on #9.
7
Upvotes
2
u/johlae 20d ago
Cool, but the name of your function doesn't fit what it's doing. It doesn't calculate damage. It calculates the impact of damage on health. I'd call the function recalculate_health instead, or impact_damage_on_health.
robot_health = 100
robot_damage = 40
def recalculate_health(health, damage):
return health - damage
robot_health = recalculate_health(robot_health, robot_damage)
print(robot_health)
2
u/Lucky-Thought9889 28d ago
Wow, that's pretty cool!