Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. def cumulsum(ls):
  2.     updated_list = []
  3.     counter = 0
  4.  
  5.     while counter < len(ls):
  6.         thing_to_add = 0
  7.         if(counter == 0):
  8.             thing_to_add += ls[0]
  9.         else:
  10.             for index in range(0,counter+1):
  11.                 thing_to_add += ls[index]
  12.         updated_list.append(thing_to_add)
  13.         counter = counter + 1
  14.     return updated_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement