While loop with "or"? Please help!

Ravi Teja webraviteja at gmail.com
Thu Jan 25 05:35:57 EST 2007


>     while usrinp != "y" or "Y" or "N" or "n": <<<<----PROBLEM

Correct way:
while usrinp != "y" or usrinp != "Y" or usrinp != "N" or usrinp != "n":
There has to be a boolean evaluation on both sides of or.

Or in this case:
while usrinp not in ['Y', 'y', 'N', 'n']:

Ravi Teja.




More information about the Python-list mailing list