Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
dict FTW solution in Speedy category for Roman Numerals by veky
def checkio(x):
a,r="",{}
for i in range(3):
p,(j,c,d)=10**i,"IVXLCDM"[2*i:][:3]
r.update({p:j,5*p:c,4*p:j+c,9*p:j+d,10*p:d})
for k in reversed(sorted(r)):
a+=x//k*r[k]
x%=k
return a
June 14, 2013
Comments: