01-02-2014, 05:13 AM
(01-02-2014, 03:09 AM)AFtExploision Wrote:But there is a problem with it.(01-02-2014, 02:57 AM)Malcolmforde Wrote: 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:
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
Too smart. I would literally make one loop like this and another like snug did because I'm a derp
"option = None" needs to be in the loop too. Just noticed that.