On Tue, 16 Dec 2008 13:59:24 -0800 Scott David Daniels <scott.dani...@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 <da...@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. -- http://mail.python.org/mailman/listinfo/python-list