# 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
# 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)
# start = 10Sum = sum(numbers, 10)
print(Sum)
sum(iterable, start)
iterable : iterable can be anything list , tuples or dictionaries, but most importantly it should be numbers.
start : this startis added to the sum of numbers in the iterable.
Ifstartisnot given in the syntax , it is assumed to be 0.