- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- 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.

- Related Questions & Answers
- Write a program to form a cumulative sum list in Python
- Python Program to Find the Cumulative Sum of a List where the ith Element is the Sum of the First i+1 Elements From The Original List
- Python program to find sum of elements in list
- Find sum of elements in list in Python program
- Program to find sum of odd elements from list in Python
- Program to find largest sum of non-adjacent elements of a list in Python
- Python Program to Find the Total Sum of a Nested List Using Recursion
- How to find sum a list of numbers in Python?
- Python – Cumulative Row Frequencies in a List
- Program to find sum of the minimums of each sublist from a list in Python
- Python program to find sum of absolute difference between all pairs in a list
- Program to find sum of non-adjacent elements in a circular list in python
- Cumulative sum of elements in JavaScript
- Program to find maximum sum of popped k elements from a list of stacks in Python
- Program to find sum of widths of all subsequences of list of numbers in Python

Advertisements