Roman numerals/Decode: Difference between revisions
m
→Python Declarative
m (→Python Declarative: Tidied) |
|||
Line 5,393:
characters are unrecognised.
'''
dct = defaultdict(
zip(▼
accumulate(chain([1], cycle([5, 2])), mul)▼
)▼
)▼
def go(mb, x):
'''Just a letter value added to or
Line 5,402 ⟶ 5,410:
else:
r, total = mb
return x, total + (-x if x < r else x)
▲ x,
▲ zip(
(0,
))(snd)▼
▲ accumulate(chain([1], cycle([5, 2])), mul)
▲ )
▲ )
▲ go,
▲ [dct[k.upper()] for k in reversed(list(s))],
▲ )(snd)
Line 5,464 ⟶ 5,460:
# snd :: (a, b) -> b
def snd(
'''Second member of a pair.'''
return
|