[Tutor] Paper Rock Scissors game - User's choice not returned properly

Alan Gauld alan.gauld at btinternet.com
Fri Nov 4 04:50:49 CET 2011


On 04/11/11 01:42, Steven D'Aprano wrote:
> Alan Gauld wrote:

> If you're worried about the screen space and/or keystrokes, you can do
> this:
>
> if direction.upper() in tuple('NSEW'): ...

It's not so much the keystrokes that I don't like but it's the fact that 
I invariably miss out a quote or a comma every time I try to construct a 
long sequence of single character strings. This avoids
that by getting Python to do the work for me.

I like it! The best of both worlds. :-)


Thanks Stephen,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list