Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clean and simple (recursion). solution in Clear category for Restricted Sum by Celshade
def checkio(data: list, total: int=0) -> int:
"""Return the running total of a list of numbers, without using restricted
keywords.
Args:
data: The list of numbers to add.
total: The current running total of the list (default=0)
"""
total += data.pop()
if len(data) > 0:
return checkio(data, total)
else:
return total
Feb. 22, 2019
Comments: