Maybe this will help you see what you have done wrong:
>>> myvar = 0
>>> while myvar != 8:
myvar = int(input("input 8 to stop the loop: "))
input 8 to stop the loop: 4
input 8 to stop the loop: 23949
input 8 to stop the loop: 8
>>>
lukerobi
Junior Poster in Training
50 posts since Sep 2009
Reputation Points: 14
Solved Threads: 16
Please use code tags when posting code
You will need to re-input the health inside the loop so that it will ask the user for the health again. I suspect the current version outputs the 'health status' waits for enter and then outputs the same status again.
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
It is much simpler and more readable if you set up your while loop this way ...
# This is a game character health simulator
# give the user instructions
print("Character health can be from 0 to 600+ (-1 exits the loop)")
while True:
health = int(input("What is your characters health?"))
if health == -1:
break # exits the while loop
if health <= 0:
print("Dead")
elif health >= 0 and health < 100:
print("Weak")
elif health > 100 and health <= 500:
print("Healthy")
elif health > 500:
print("Strong!")
input("Press Enter")
Simply an endless loop with an exit condition.
Note: This is Python3 code
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417