"number-in-base" ``oneliner''

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Mon Nov 1 05:06:24 EST 2004


Andrea Griffini wrote:

> roman = lambda x: "".join(["".join(map(lambda c: "IVXLCDM"[int(c)
> +2*N],"/0/00/000/01/1/10/100/1000/02".split("/")[x//10**N % 10]))
> for N in (3, 2, 1, 0)])

This rocks!! I'm still trying to understand how it works though :)
--Irmen



More information about the Python-list mailing list