Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cumulsum(ls):
- updated_list = []
- counter = 0
- while counter < len(ls):
- thing_to_add = 0
- if(counter == 0):
- thing_to_add += ls[0]
- else:
- for index in range(0,counter+1):
- thing_to_add += ls[index]
- updated_list.append(thing_to_add)
- counter = counter + 1
- return updated_list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement