Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Restricted Sum by aya.kanazawa
def recursive(data, index):
if index == 0:
return data[index]
else:
return data[index] + recursive(data, index - 1)
def checkio(data):
return recursive(data, len(data) - 1)
if __name__ == '__main__':
print("Example:")
print(checkio([1,5,6]))
assert checkio([1,5,6]) == 12
assert checkio([0,3,12,9]) == 24
print("Coding complete? Click 'Check' to earn cool rewards!")
April 24, 2019
Comments: