Python sum() function
Published February 17, 2022In programming, you may need to find the sum of the numbers in a specified list. To do so, we use the python sum() built-in function, which sums up the numbers in a given list.
Syntax of the sum()
The sum() method is written as follows:
Sum(iterable or list of numbers in a list) |
Example
In this example, we are going to find the sum of the numbers in a list.
my_list = [1,2,3,4,5,6,7,8,9,10] |
Output
The sum of the numbers in the list is 25
Article Contributed By :
|
|
|
|
259 Views |