Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Set Theory solution in Uncategorized category for Funny Addition by Flx
from functools import reduce
def checkio(data):
a,b = data
zero = []
succ = lambda a: [x for x in a] + [y for y in [a] if y not in a]
add = lambda a, b: reduce(lambda res, x: succ(res), a, b)
to_zf = lambda x: succ(to_zf(x - 1)) if x != 0 else zero
return reduce(lambda a, b: a + 1, add(to_zf(a), to_zf(b)), 0)
if __name__ == '__main__':
assert checkio([5, 5]) == 10, 'First'
assert checkio([7,1]) == 8, 'Second'
print('All ok')
Nov. 25, 2012
Comments: