Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Reverse Roman Numerals by Ordik
ROMANS = {'CM': 900, 'CD': 400, 'XC': 90, 'XL': 40, 'IX': 9, 'IV': 4, 'I': 1,
'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
def reverse_roman(roman_string):
res = 0
for x in ROMANS:
res += ROMANS[x] * roman_string.count(x)
roman_string = roman_string.replace(x, '')
return res
Nov. 23, 2020
Comments: