I want to get a running total from a list of numbers.
For demo purposes, I start with a sequential list of numbers using range
range
a = range
If you can use numpy, it has a built-in function named cumsum that does this.
cumsum
import numpy tot = numpy.cumsum(a) # returns a numpy.ndarray tot = list(tot) # if you prefer a list