+ 2

while loops within while loops

im writing my own hangman game and im having issues with this part while x != 6: hang = input("choose a letter : ") print("") while (len(hang)) > 1: print("one letter at a time hero") hang = input("choose a letter : ") while hang in used: hang = input("letter already used try again : ") print("") while (len(hang)) == 0: hang = input("you must guess a letter hero : ") print("") while hang.isdigit(): hang = input("your guessing words not numbers hero guess a letter : ") the issue is that if one of these catches an error it will work however if it say you enter a number and then enter two letters the double letters will go through how can i change the code to fix this

12th Dec 2017, 4:42 AM
David Aseltine
David Aseltine - avatar
2 Antworten
+ 2
I'll try the if / elif statements and see if that works and post the results
12th Dec 2017, 5:13 AM
David Aseltine
David Aseltine - avatar
+ 1
the if elif statements worked thank you
12th Dec 2017, 2:02 PM
David Aseltine
David Aseltine - avatar