title: Compute cummulative sum until a zero appears
body: <p>I have a (long) list in which zeros and ones appear at random:</p>
  <p><code>list1 = [1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1]</code></p>
  <p>1.I want to get another list</p>
  <ul>
  <li>the sum of the list up to where 0 appears</li>
  <li>where 0 appears, retain 0 in the list</li>
  </ul>
  <p><code>list2 = [3, 0, 2, 0, 1, 0, 3]</code></p>
  <p>It should work for corner cases as well like zeroes at start or end
  <code>list1 = [0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0]</code>
  <code>list2 = [0, 3, 0, 2, 0, 1, 0, 3, 0]</code></p>