Answers for "sum()"

1

sum()

#if we have list
list=[1,2,3]
Sum=sum(list)
print(Sum)
Posted by: Guest on October-12-2021
2

sum() python

numbers = [2.5, 3, 4, -5]

# start parameter is not provided
numbers_sum = sum(numbers)
print(numbers_sum)
# output = 4.5

# start = 10
numbers_sum = sum(numbers, 10)
print(numbers_sum)
# output = 14.5
Posted by: Guest on January-27-2021

Browse Popular Code Answers by Language