Problem I have with a while loop/boolean/or
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Mar 15 19:25:08 EDT 2007
En Wed, 14 Mar 2007 15:34:20 -0300, Fabio FZero <fabio.fzero at gmail.com>
escribió:
> Why don't you try this instead:
>
> hint = raw_input("\nAre you stuck? y/n: ")
> hint = hint.lower()
>
> while not hint in 'yn':
> hint = raw_input("Please specify a valid choice: ")
Dangerous: what if the user types 'yn'?
`hint in list('yn')` may be better, if you don't like the previous answers.
--
Gabriel Genellina
More information about the Python-list
mailing list