Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Roman Numerals by przemyslaw.daniel
def checkio(number):
r=[x.split(',') for x in [',I,II,III,IV,V,VI,VII,VIII,IX',
',X,XX,XXX,XL,L,LX,LXX,LXXX,XC',',C,CC,CCC,CD,D,DC,DCC,DCCC,CM',',M,MM,MMM']]
return ''.join(reversed([r[x][int(y)] for x,y in enumerate(str(number)[::-1])]))
if __name__ == '__main__':
assert checkio(6) == 'VI', '6'
assert checkio(76) == 'LXXVI', '76'
assert checkio(499) == 'CDXCIX', '499'
assert checkio(3888) == 'MMMDCCCLXXXVIII', '3888'
April 27, 2016