Running Total

noun

say it: “RUN-ing TOH-tul” /ˈrʌnɪŋ ˈtoʊtəl/

A total that is updated as each new amount is added, so it always shows the sum so far.

What is a running total?

A running total is a number you keep adding to as you go through rows one at a time, such as a store's sales so far. Starting at 0 and adding each row's amount gives the total at the end; a dictionary can keep one running total for each store.

sales_by_store = {}
for order in orders:
    sale = order["quantity"] * order["unit_price"]
    sales_by_store[order["store"]] = sales_by_store.get(order["store"], 0) + sale

In a sentence

  • “The loop kept a running total of each store's sales.”
  • “After the tenth order, the running total was $41.50.”

Level: Novice · More Python terms at this level

Updated