Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Restricted Sum by Bartosz_M
def dodaj(data):
if len(data) == 1:
return data[0]
else:
data[0] = data[0] + data[1]
del data[1]
dodaj(data)
data = data[0]
return data
def checkio(data):
return dodaj(data)
assert checkio([1, 2, 3]) == 6
assert checkio([2, 2, 2, 2, 2, 2]) == 12
Nov. 10, 2016