python coding contest

roberto.alsina at roberto.alsina at
Fri Dec 30 14:53:17 CET 2005

Thomas Heller wrote:
> X=' _ _ _  |  _| _ |_|_    '
> Y=0x23018F406A3530EC273F008
> j="".join
> seven_seg=lambda n:j(j(c)+"\n"for c in zip(*[X[Y>>m+int(d)*9&7::8]for d in n for m in(6,3,0)]))

Interesting bit:

Although there are more 3-char combinations when you read vertically,
they compact better.

If A=" ", B="_" and C="|", this 12 char string contains al possible


which is 2 chars shorter than the best for horizontal combinations:


Still, I don't think this vertical idea can go below 123 or 124, but
it's good :-)

Now I wonder what the 119 solution is!

More information about the Python-list mailing list