trying to get this type of loop working but no luck. It is for a lesson I am having with some pupils talking about a short text based adventure. We are trying to understand the concept of nested if's in while loops but i'm having trouble with this one from the book.
while life >=1:
attack=str(input("Enter Attack"))
if attack == "jab":
print ("Jab")
elif attack == "kick":
print ("kick")
attack = str(input("Enter Attack"))
I've tried the movement of the attack variable but to no avail. At the moment, it repeatedly prints out Jab even if kick is entered. For some reason, every other command is a Jab.
Any help would be great!
Aucun commentaire:
Enregistrer un commentaire