python coding contest
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Mon Dec 26 19:32:33 EST 2005
On Mon, 26 Dec 2005 13:33:42 -0700, Tim Hochberg wrote:
> Claudio Grondi wrote:
>> I am currently at 39 bytes following the requirements and the principle
>> given above (my module passes the test). Anyone able to beat that?
>
> Wow! It'll be interesting to see how to do that. The obvious way gives
> 53 bytes. Hmmm, I'll have to see what can be done...
OBVIOUS???
The only algorithm obvious to me came to two lines and about 300
characters with all the pruning I could come up with. Changing algorithms
made it longer. I am finding it hard enough to credit that half a dozen
people are claiming lengths of around 130-180 characters -- 39 or 53 bytes
just seems physically impossible to me, especially given that nine of
those bytes are the name of the function!
The identity function seven_seg=lambda s:s takes 20 bytes and does
nothing. That leaves NINETEEN bytes to implement the functionality. In the
immortal words of Bill and Ted: "No way dude!"
You excellent dudes are righteously bodacious!
--
Steven.
More information about the Python-list
mailing list