- Related Questions & Answers
- Python program to find sum of elements in list
- Find sum of elements in list in Python program
- How to find sum a list of numbers in Python?
- Python program to find sum of absolute difference between all pairs in a list
- Python Program to find the sum of array
- How to create a Cumulative Sum Column in MySQL?
- Python Program for Find sum of even factors of a number
- Python Program for Find sum of odd factors of a number
- Find sum of even factors of a number in Python Program
- Find the sum of array in Python Program
- Python program to find the sum of all items in a dictionary
- Python program to find largest number in a list
- Python - Find all triplets in a list with given sum
- Python Program for Find minimum sum of factors of number
- C# Program to find the sum of a sequence

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

In this article, we will learn about the solution to the problem statement given below.

**Problem statement **− We are given a list, we need to create a list with the cumulative sum.

Now let’s observe the solution in the implementation below −

# cumulative sum def Cumulative(l): new = [] cumsum = 0 for element in l: cumsum += element new.append(cumsum) return new # Driver Code lists = [10, 20, 30, 40, 50] print ("New list:",Cumulative(lists))

New list: [10, 30, 60, 100, 150]

All the variables are declared in the local scope and their references are seen in the figure above.

In this article, we have learned about how we can make a Python program to find the Cumulative sum of a list.

Advertisements