On 25/01/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> 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']:

or better still

while usrinp.lower() not in ['y', 'n']:

:):)


-- 

Tim Williams
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to