Alan Gauld wrote:
On 31/10/11 20:22, Peter Otten wrote:
Alan Gauld wrote:

if choice.lower() not in ('prs'): # NB use a single string

That's not a good idea. If a user accidentally enters PR (for example) your
version will mistake that for a valid choice.

Good point, although  you could test the first character only...

if choice[0].lower() not in ('prs'): # NB use a single string

Why would you do that? If the user is supposed to enter a single letter, why would you accept (for example) "screw you hippy, I hate this game!" as the valid response "s"?



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to