While loop with "or"? Please help!

Paul Rubin http
Thu Jan 25 13:37:06 CET 2007


wd.jonsson at gmail.com writes:
>     while usrinp != "y" or "Y" or "N" or "n": <<<<----PROBLEM

    while userinp not in 'yYnN':
      ...

Or maybe more generally:

    while userinp.lower() not in 'yn':    # case independent test
       ...



More information about the Python-list mailing list