Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Restricted Sum by a2a2a2a2oku
def checkio(data, a = 0):
if len(data) == 0:
return a
else:
a += data.pop()
print(a)
return checkio(data, a)
if __name__ == "__main__":
assert checkio([1,2,3]) == 6
assert checkio([2,2,2,2,2,2]) == 12
assert checkio([3,4,6,5,2]) == 20
June 27, 2017