Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Another derelict battery solution in Creative category for Reverse Roman Numerals by veky
import enum, re
def constant(c): return lambda *_: c
class Roman(enum.Enum):
IV, IX, XL, XC, CD, CM = 4, 9, 40, 90, 400, 900
I, V, X, L, C, D, M = 1, 5, 10, 50, 100, 500, 1000
def reverse_roman(s):
val, () = re.Scanner([(r.name, constant(r.value)) for r in Roman]).scan(s)
return sum(val)
July 6, 2017
Comments: