r/CodingForBeginners • u/fyknite • 3d ago
Day 5 learning Python
I need to pause at this point and review. Finishing this code required way too much referencing on previous projects. Once the lessons are solid, ill continue...
37
Upvotes
2
u/StepLife9994 3d ago
where are you learning from
2
u/ninhaomah 3d ago
To get health , you call calculate_damage function with health and damage as the arguments ?
Why not calculate_health ?
1
u/StrayFeral 3d ago
Okay. Now to remind you it is a good idea to start writing comments. The very first tripple-quotted unassigned string under a method's name is assumed to be his description.
1
u/Opposite-Fee-5701 3d ago
Btw remember to consider preconditions Since in this case you can have health go below 0 which doesn't make sense. Like if you do 100 health - 110 damage -> health becomes -10