Need help improving number guessing game
Arnaud Delobelle
arnodel at googlemail.com
Wed Dec 17 05:46:42 EST 2008
"D'Arcy J.M. Cain" <darcy at druid.net> 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")):
Or:
if s[:1] not in ("y", n"):
--
Arnaud
More information about the Python-list
mailing list