Running Total
sales[i] is the money earned on day i. Return a list where item i is the total earned from day 0 up to and including day i. Hint: np.cumsum.
Example 1
sales [3,1,4,1]
returns [3,4,8,9]
The totals are 3, 4, 8, 9.
Constraints
1 <= len(sales) <= 100
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Same PositionsBeginner
- Shopping TotalBeginner
- Side by Side ColumnsBeginner
- Sign of EachBeginner
- Sorted DistinctBeginner
- Standard DeviationBeginner
- Swap Rows and ColumnsBeginner
- Third QuartileBeginner