Running total

Report a typo

Given a string of digits, create a list in which each number is a digit from this input string. Then, use this list to calculate the running total, or cumulative sum. Essentially, it's a list of partial sums that gets updated every time a new element appears.

For example, we can transform the list [1, 2, 3] to [1, 1 + 2, 1 + 2 + 3], which equals [1, 3, 6].

Sample Input 1:

15325

Sample Output 1:

[1, 6, 9, 11, 16]
Write a program in Python 3





___

Create a free account to access the full topic