def cumsum(iterable):
 n = 0
 for x in iterable:
  n += x
  (yield n)

def cumsum ( iterable ) : n = 0 for x in iterable : n += x ( yield n )
return the cumulative sum of the elements along a given axis .