python coding contest
Tim Hochberg
tim.hochberg at ieee.org
Tue Dec 27 17:42:20 EST 2005
Jean-Paul Calderone wrote:
> On Tue, 27 Dec 2005 14:02:57 -0700, Tim Hochberg <tim.hochberg at ieee.org> wrote:
>
>>Shane Hathaway wrote:
>>
>>>Paul McGuire wrote:
>>>
>>>
>>>Also, here's another cheat version. (No, 7seg.com does not exist.)
>>>
>>> import urllib2
>>> def seven_seg(x):return urllib2.urlopen('http://7seg.com/'+x).read()
>>>
>>
>>And another one from me as well.
>>
>>class a:
>> def __eq__(s,o):return 1
>>seven_seg=lambda i:a()
>>
>
>
> This is shorter as "__eq__=lambda s,o:1".
>
> But I can't find the first post in this thread... What are you
> guys talking about?
There's a contest described at http://www.pycontest.net/. People have
been working on two sorts of solutions: 'honest' solutions that actually
do what's described there. The best of these are around 130 characters.
There's also a set of 'cheat' solutions that fool the supplied test
program. I suspect that these will not pass muster when they actually
get submitted, but we'll see I suppose. A couple of people have figured
out how to write these cheating solution extremely compactly (32 bytes).
One of the simpler ones is:
import test;seven_seg=test.test_vectors.get
This will make sense if you look at the kit supplied by the above site.
-tim
More information about the Python-list
mailing list