Need help improving number guessing game

Arnaud Delobelle arnodel at
Wed Dec 17 11:46:42 CET 2008

"D'Arcy J.M. Cain" <darcy at> writes:

> On Tue, 16 Dec 2008 13:59:24 -0800
> Scott David Daniels <Scott.Daniels at Acm.Org> wrote:
>>> > def yesno(s):
>> >    s = s.strip().lower()
>> >    if not s in ("y", "n"):

There was a thread about "is not" recently.  Python also allows "not in".

        if s not in ("y", "n"):

> You could also do this to be a little more user friendly:
>   if not (s and s[0] in ("y", "n")):

    if s[:1] not in ("y", n"):


More information about the Python-list mailing list