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 l.szyman10
roman = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000}
def reverse_roman(roman_string):
decimals = [roman[i] for i in roman_string]
return sum([n if decimals[i+1]<=n else -n for i, n in enumerate(decimals[:-1])]) + decimals[-1]
Aug. 11, 2020
Comments: