title: List comprehension with an accumulator
body: <p>What is the best way to replicate this simple function using a list comprehension (or another compact approach)?</p>
  
  <pre><code>import numpy as np
  
  sum=0
  array=[]
  for i in np.random.rand(100):
     sum+=i
     array.append(sum)
  </code></pre>