Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
except: pass solution in Clear category for Safe Code by flpo
from contextlib import suppress
from string import digits
def safe_code(eq):
def solve(i):
try: return i not in eq and eval(eq.replace('#', i))
except: pass
eq = eq.replace('=', '==')
return int(next(filter(solve, digits[eq.startswith('##') or '=##' in eq:]), -1))
Sept. 16, 2018
Comments: