Problem I have with a while loop/boolean/or

israphelr at googlemail.com israphelr at googlemail.com
Tue Mar 13 23:34:04 CET 2007


Hi all.

I have a problem with some code :(

-----------

hint = raw_input("\nAre you stuck? y/n: ")
hint = hint.lower()

while (hint != 'n') or (hint != 'y'):
    hint = raw_input("Please specify a valid choice: ")

---------------------------------------------

so everytime I run the program, and enter my choice as y or n, I'm
told to 'Please Specify a valid Choice Again' and can't get out of the
loop.



-----------

hint = raw_input("\nAre you stuck? y/n: ")
hint = hint.lower()

while (hint != 'n'):
    hint = raw_input("Please specify a valid choice: ")

---------------------------------------------

As for here when I enter n, I can leave the while loop.

Anyway I can't put my finger on this, so I'd be real grateful if
someone could tell me what I've done wrong. Thanks.
(I have a guy feeling it's something really silly I'm overlooking...)




More information about the Python-list mailing list