October 4th, 2012, 04:39 PM
Join Date: Oct 2012
Time spent in forums: 9 m 9 sec
Reputation Power: 0
Hey! I'm trying to program a very simplistic hangman game, and in doing so, I have to break out of a while loop after so many right guesses or so many wrong guesses. The while loop ends if I have just one conditional statement, but when I include [conditional1 or conditional2] the loop continues infinitely. Is there any way I can remedy this? My code is posted below
a=['hello', 'goodbye', 'hola', 'chao']
while guessWrong < 7 or guessRight < len(a[n]):
g=raw_input("Guess a letter: ")
if(g in a[n]):
print "Word contains " + str(gr)
print "Incorrect guess\n"
print "You lost"
print "You win"