We are creating a loop in my CSET class and I am stuck. This is the original script I created:
#This is a game character health simulator
health = int(input("What is your characters health?"))
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")
We are supposed to Use a while loop to let user repeat steps 2 . Use number -1 (negative 1) to stop the loop. This is what I have come up with but I can't get it to work.
#This is a game character health simulator
health = int(input("What is your characters health?"))
while health != -1:
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")
Any help is greatly apperciated.