Skip to content

Instantly share code, notes, and snippets.

@Drakekin
Last active June 7, 2019 13:01
Show Gist options
  • Save Drakekin/afcaab775ee9b8f6243246df590e63ba to your computer and use it in GitHub Desktop.
Save Drakekin/afcaab775ee9b8f6243246df590e63ba to your computer and use it in GitHub Desktop.
Computing roman numerals without es
bad_l_tt_r = chr(101)
num_rals = {
"M": 1000,
"CM": 900,
"C": 100,
"XC": 90,
"L": 50,
"XL": 40,
"X": 10,
"IX": 9,
"V": 5,
"IV": 4,
"I": 1,
}
class Whil_:
pass
builtins = __builtins__.__dict__
s_tattr = builtins["s{}tattr".format(bad_l_tt_r)]
g_tattr = builtins["g{}tattr".format(bad_l_tt_r)]
n_xt = builtins["n{}xt".format(bad_l_tt_r)]
it_r = builtins["it{}r".format(bad_l_tt_r)]
s_tattr(Whil_, "stop", 0)
s_tattr(Whil_, "__n{}xt__".format(bad_l_tt_r), lambda s: n_xt(it_r([1] * (1 - s.stop))))
s_tattr(Whil_, "__it{}r__".format(bad_l_tt_r), lambda s: s)
s_tattr(Whil_, "br_ak", lambda s: s_tattr(s, "stop", 1))
whil_ = Whil_()
for _ in whil_:
usr_str = input("Pl{0}as{0} typ{0} your numb{0}r: ".format(bad_l_tt_r))
int_g_r = int("".join([c for c in usr_str if c in "0123456789"]))
roman = ""
for l_tt_r, num_ral in g_tattr(num_rals, "it{}ms".format(bad_l_tt_r))():
comp = Whil_()
for _ in comp:
if num_ral > int_g_r:
comp.br_ak()
if num_ral <= int_g_r:
int_g_r -= num_ral
roman += l_tt_r
print(roman)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment