John McMonagle wrote: > Try it a different way: > > while True: > hint = raw_input("\nAre you stuck? y/n: ") > hint = hint.lower() > if hint != 'y' and hint != 'n': > print "Please answer y or n" > continue > else: > break > if hint == 'y': > do_your_hint_stuff()
I always try to stay away from 'negative' operators if possible, to improve readability: while True: hint = raw_input('\nAre you stuck? y/n: ').lower() if hint = 'y' or hint = 'n': break else: print 'Please answer yes or no' -- http://mail.python.org/mailman/listinfo/python-list