Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Compare Functions by juestr
def checkio(f, g):
status = [
[['different', 'g_error'], ['f_error', 'both_error']],
[['same', 'g_error'], ['f_error', 'both_error']] ]
def h(*args, **kwargs):
def run(f):
try:
return f(*args, **kwargs)
except Exception:
return None
r, s = run(f), run(g)
return (
r if r is not None else s,
status[r == s][r is None][s is None])
return h
May 17, 2019