Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Roman Numerals by mkomarova
def checkio(data):
d={1000:'M',900:'CM',500:'D',400:'CD',100:'C',90:'XC',50:'L',40:'XL',10:'X',9:'IX',8:'VIII',7:'VII',6:'VI',5:'V',4:'IV',3:'III',2:'II',1:'I'}
d2=[1000,900,500,400,100,90,50,40,10]
ans=''
for i in range(len(d2)):
if data//d2[i]!=0:
ans=ans+d[d2[i]]*(data//d2[i])
data=data-d2[i]*(data//d2[i])
if data!=0:
ans=ans+d[data]
return ans
Nov. 9, 2016