While loop with "or"? Please help!
bruno.desthuilliers at websiteburo.com
Thu Jan 25 13:43:43 CET 2007
Peter Otten a écrit :
> Bruno Desthuilliers wrote:
>> and simplified again thanks to Python 'in' operator:
>> while not usrinp.lower() in "yn":
> But note that 'in' performs a substring search and therefore "yn" and ""
> would be accepted as valid answers, too.
Mmm, right. Thanks for the correction.
while not usrinp.lower() in ['y', 'n']:
More information about the Python-list