python coding contest

Tim Hochberg tim.hochberg at ieee.org
Tue Dec 27 14:10:52 EST 2005


py pan wrote:
> When you guys say 127~150 characters, did you guys mean
> usinging test_vectors.py in some way? Or there's no import at all?
> 

No import at all. The shortest solution reported so far is 131 
characters. Getting down to 127 is just a guess as to where the lower 
bound is likely to be.

Note that in principle it's possible to encode the data for how to 
display a digit in one byte. Thus it's at least theoretically possible 
to condense all of the information about the string into a string that's 
10 bytes long. In practice it turns out to be hard to do that, since a 
10 byte string will generally have a representation that is longer than 
10 bytes because of the way the escape sequences get printed out. As a 
result various people seem to be encoding the data in long integers of 
one sort or another. The data is then extracted using some recipe 
involving shifts and &s.

-tim




More information about the Python-list mailing list