01-02-2014, 02:57 AM
Hangman:
Why do you have the hangman game code in a while loop controlled by a variable changed at the end of the game? You should just have "while True", and if the player chooses not to play again it runs exit(), like this:
Why do you have the hangman game code in a while loop controlled by a variable changed at the end of the game? You should just have "while True", and if the player chooses not to play again it runs exit(), like this:
Code:
option = None
while True:
#Ur sexy code here
while option != "Y" and option != "N":
option = str(raw_input("Would you like to continue? [Y/N] "))
if option.upper() == "N":
exit()
elif option.upper() != "Y" and option.upper() != "N":
print "Not an option!"
else:
break