Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Naive solution in Clear category for Compare Functions by obone
def checkio(f, g):
def w(fun, *args, **kwargs):
try: return fun(*args, **kwargs)
except: return None
def h(*args, **kwargs):
fres = w(f, *args, **kwargs)
gres = w(g, *args, **kwargs)
if fres == None and gres == None:
stat = 'both_error'
elif gres == None:
stat = 'g_error'
elif fres == None:
stat = 'f_error'
elif fres == gres:
stat = 'same'
else:
stat = 'different'
return (fres if fres != None else gres, stat)
return h
Sept. 29, 2019