Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
roman-numerals solution in Clear category for Roman Numerals by hedgeven
def checkio(data):
nums = {'I': 1, 'IV': 4, 'V': 5, 'IX': 9, 'X': 10, 'XL': 40, 'L': 50,
'XC': 90, 'C': 100, 'CD': 400, 'D': 500, 'CM': 900, 'M': 1000 }
result=''
for k in sorted(nums, key=nums.__getitem__)[::-1]:
if data>=nums[k]:
d, data = divmod(data, nums[k])
result += d*k
return result
May 19, 2014
Comments: