Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple, straightforward solution. solution in Clear category for Roman Numerals by dunpealer
def checkio(data):
NS = ('I', 'V', 'X', 'L', 'C', 'D', 'M', 'Z')
nums = []
digits = reversed(tuple(map(int, str(data))))
for j, d in enumerate(digits):
i = j * 2
five, ones = divmod(d, 5)
if ones == 4:
n = NS[i] + NS[i+1+five]
else:
n = NS[i+1] * five + NS[i] * ones
nums.append(n)
return ''.join(reversed(nums))
Sept. 7, 2015