Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Roman Numerals by Vottivott
def checkio(data):
values, symbols, times = [1000,500,100,50,10,5,1], ['M','D','C','L','X','V','I'], [0]*7
for i,v in enumerate(values):
times[i] = data // v
data %= v
long_roman = "".join(symbols[i]*times[i] for i in range(7) if times[i])
return long_roman.replace("VIIII","IX").replace("IIII","IV").replace("LXXXX","XC").replace("XXXX","XL").replace("DCCCC","CM").replace("CCCC","CD")
Jan. 23, 2015
Comments: