Need help improving number guessing game
D'Arcy J.M. Cain
darcy at druid.net
Tue Dec 16 17:24:16 EST 2008
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"):
You could also do this to be a little more user friendly:
if not (s and s[0] in ("y", "n")):
Or reverse the test for clarity.
--
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list