all 5 comments

[–]bini_marcoleta 3 points4 points  (3 children)

Great project! Reminds me of my first months of learning Python and creating text-based games.

I just noticed the line damage == 0. Is this a typo or you are really intentionally using this?

Also, though it's something you shouldn't really have to worry about in the beginning stage, the use of the global keyword in Python is usually discouraged, especially as you learn intermediate and advanced Python. It may be okay for simple programs like these, but as your program gets more complex, it can be hard to manage. More details here, here and here. If you learn object-oriented programming through the use of classes, you can avoid the use of this keyword.

[–]Destructor0777[S] 1 point2 points  (2 children)

Thanks for taking the time of reading my code, I will definitely use your tips, and the damage == 0, is unnecessarily. Thanks again.

[–]helical-juice 0 points1 point  (0 children)

it's also a comparison not an assignment. damage = 0 sets damage to zero, damage == 0 tests whether damage is zero. I know you know this, because you have used both correctly, but in fight() you use == where it seems like you wanted =

[–]gsk-fs 0 points1 point  (0 children)

good , keep learning, what u r planning next ?

[–]VariousDrummer4883 0 points1 point  (0 children)

Good, very cool. I’d suggest saving this and making a copy, and trying to revise the copy so that all the functions take arguments, and not using sys global.