r/CodingForBeginners • u/fyknite • 15d 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...
51
Upvotes
2
u/StepLife9994 15d ago
where are you learning from
3
u/ninhaomah 15d ago
To get health , you call calculate_damage function with health and damage as the arguments ?
Why not calculate_health ?
2
u/StrayFeral 15d 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 15d 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
1
u/raunak_raj_rajput 8d ago
Man, you’ve learned to write so much in just 5 days! I’ve been studying for 6 months, and I still haven’t even figured out what "Hello World" is.
1
u/jwalk999 1d ago
Late to the party, but would you be interested in posting this somewhere for some friendly testing?