Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Casual generator solution in Clear category for Reverse Roman Numerals by V.Shkaberda
ROMAN = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000}
def reverse_roman(roman):
return sum(ROMAN[r] * ((~(ROMAN[r] < ROMAN[nr])<<1)+3)
for r, nr in zip(roman, roman[1:] + 'I'))
Sept. 5, 2019
Comments: