Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
It's a sign solution in Clear category for Reveal the Number by StefanPochmann
def reveal_num(line: str) -> int | float | None:
sign = digits = ''
for c in line:
if c.isdigit():
digits = digits * (digits != '0') + c
if c == '.' not in digits:
digits += c
if c in '+-' and not digits:
sign = c
if digits:
return eval(sign + digits)
March 16, 2023
Comments: