# Python code to demonstrate the working of # sum() numbers = [1,2,3,4,5,1,4,5] # start parameter is not provided Sum = sum(numbers) print(Sum) # result is 25 # start = 10 Sum = sum(numbers, 10) print(Sum) # result is 10 +25 = 35
Here is what the above code is Doing:
1. We have created a list of numbers.
2. We have used the sum() function to find the sum of the list.
3. We have used the sum() function again, but this time we have provided a start parameter.
4. The start parameter is used to specify the starting value for the sum.
5. The sum() function returns the sum of the list, starting from the start parameter.