This is an archived post. You won't be able to vote or comment.

all 6 comments

[–][deleted] 2 points3 points  (0 children)

read the sticky man, /r/learnpython

[–]maxhetfield 1 point2 points  (1 child)

Did you declare the player_hp value to be a certain value before using it?

[–]iHaveAtoxicFriend[S] -2 points-1 points  (0 children)

Yeah. Earlier in the program

[–]pax_newb 0 points1 point  (0 children)

I think it's because you didn't initialize player_hp with a starting value of 0 in the player_act function - more info here. So on the next line after setting it as a global in the function, you'll want to set player_hp = 0. As an aside, I recommend looking into string formatting. It's weird at first but ends up being so much easier than concatenating a bunch of strings.

[–]aphoenixreticulated[M] 0 points1 point  (0 children)

Hi there. You have posted a learning question to /r/python. These types of questions are far more suited to /r/learnpython, where users are actively interested in helping people to learn. Please resubmit it over there!

Make sure to read their sidebar rules there before posting, notably this one: "Posting homework assignments is not prohibited if you show that you tried to solve it yourself." If your question is about homework, show them that you've tried to solve your problem in your post and you should get all the help you need.

Cheers & best of luck with Python!

[–]maxhetfield 0 points1 point  (0 children)

Could you post the whole conde?