In <[email protected]> [email protected]
writes:
> I've got it working! I'm really enjoying python :) But now i'd like to make
> it break out of the while loop when the user guesses more than 5 numbers and
> fails
The "Congratulations" message is inside the while loop; that's why it
always prints.
To break after five guesses, you could change the while loop to this:
while (guess != number) and (tries < 5):
And then after the while loop, put this if statement:
if (tries < 5):
print "\nCongratulations! You guessed my number in", tries, "tries"
else:
print "Sorry, you lost!"
--
John Gordon A is for Amy, who fell down the stairs
[email protected] B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
--
http://mail.python.org/mailman/listinfo/python-list