python sum function code example
Example 1: sum() python
numbers = [2.5, 3, 4, -5]
numbers_sum = sum(numbers)
print(numbers_sum)
numbers_sum = sum(numbers, 10)
print(numbers_sum)
Example 2: python sum of list
>>> list = [1, 2, 3]
>>> sum(list)
6
Example 3: python sum
numbers = [2.5, 3, 4, -5]
numbers_sum = sum(numbers)
print(numbers_sum)
numbers_sum = sum(numbers, 10)
print(numbers_sum)
Example 4: python sum
x = [1,2,3,4,5]
s = sum(x)
print(s)
Example 5: python sum
a = 3
b = 5
c = sum (a + b)
print(c)