Skip to content
Snippets Groups Projects
13.py 268 B
Newer Older
Iida Pyykkönen's avatar
Iida Pyykkönen committed
# Write a function solve that returns the running sum of a list. 
# The running sum is the sum of all elements up to each index.

Iida Pyykkönen's avatar
13
Iida Pyykkönen committed
def solve(nums):
    result = [nums[0]]
    for i in range(1, len(nums)):
        result.append(result[i - 1] + nums[i])
    return result