python coding contest

Tim Hochberg tim.hochberg at ieee.org
Tue Dec 27 12:48:19 EST 2005


Shane Hathaway wrote:
> Tim Hochberg wrote:
> 
>>Paul McGuire wrote:
>>
>>
>>>"Shane Hathaway" <shane at hathawaymix.org> wrote in message
>>>news:mailman.2581.1135676005.18701.python-list at python.org...
>>>
>>>
>>>
>>>>I'm down to 133 characters (counted according to 'wc -c') on a single
>>>>line.  It contains about 11 whitespace characters (depending on what you
>>>>consider whitespace.)  It's way too tricky for my taste, but it's fun to
>>>>play anyway.  Has anyone done better so far?  Here's a hint on my
>>>>strategy: the code contains three large integers. :-)
>>>>
>>>
>>>With 1 large integer, I am down to 200 characters on 1 multiline line.  I
>>>can guess why you have 3 integers vs. 1, but I don't see how that saves you
>>>any characters of code.
>>
>>
>>This is interesting. I have a six line solution that is 133 characters 
>>long.
> 
> 
> 133 characters according to 'wc -c'? 

Indeed:

C:\...\pycontest_01>wc -c seven_seg_8.py
     133 seven_seg_8.py

I you strip leading and trailing whitespace, it's 122 characters. For 
comparison, seven_seg_1.py is 816 characters long:)

> If so, that will surely win style 
> points over my one-line monster.  

It's pretty readable, at least with the right tabs setting in one's 
editor, except for the guts of the thing, which consists of 21 
characters of marvelously inscrutable goop.

> But I bet someone's going to do better 
> (without cheating.)

I expect so. However, most people, at least those that are talking, seem 
to be stalling out in the low 130s, so I predict the final winner will 
be 127-130 characters long.

-tim




More information about the Python-list mailing list