Running totals of integers
Input
running_total([1, 2, 3, 4])
Output
[1, 3, 6, 10]
Cumulative sums: 1, 1+2=3, 3+3=6, 6+4=10
Full lesson preview
Use itertools.accumulate to compute cumulative sums efficiently.
Problem statement
Task
Examples
Input
running_total([1, 2, 3, 4])
Output
[1, 3, 6, 10]
Cumulative sums: 1, 1+2=3, 3+3=6, 6+4=10
Input format
Output format
Constraints
Samples
Input
running_total([10, -2, 3])
Output
[10, 8, 11]
10, then 10+(-2)=8, then 8+3=11