Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Table look up solution in Clear category for Roman Numerals by cmchao
def checkio(data):
al_1 = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]
al_10 = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]
al_100 = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"]
al_1000 = ["", "M", "MM", "MMM"]
return al_1000[data // 1000] + al_100[data % 1000 // 100] + al_10[data % 100 // 10] + al_1[data % 10]
#These "asserts" using only for self-checking and not necessary for auto-testing
May 20, 2014