fork download
  1. a1 = [1, 2, 3, 4, 5, 6]
  2. a2 = []
  3. sum = 0
  4. for x in a1:
  5. sum += x
  6. a2.append(sum)
  7.  
  8. print(a2)
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
[1, 3, 6, 10, 15, 21]