Running total of sales

Easyfor loopappend· 10 XP

A dashboard shows "sales so far this month" for each day: that day's sales plus every day before it.

Write a function running_total(sales) that takes a list of daily sales and returns a new list where each value is the total up to and including that day.

How it's checked

Your code runs, then the check below runs and its printed output is compared with ours.

  • running_total([5, 3, 4]) returns [5, 8, 12]
  • An empty list gives an empty list

Hints, the later steps and the answer come with Pro.

def running_total(sales):
    ...