The math.fsum() function calculates the total sum of  the elements of an iterable object.   

Syntax:
math.fsum(iterable)
copy

Where, the iterable parameter is the iterable object such as a list, tuple, or range object, containing the sequence of numbers to be summed.

The function returns the sum of the elements in the iterable as a float. If the iterable is empty, the function returns 0.0.

ExampleEdit & Run
import math

print(math.fsum([]))
print(math.fsum([1, 2]))
print(math.fsum([5, 15, 20, 25, 30, 45, 50]))
print(math.fsum((0.1, 0.12, 0.15, 0.14, 0.55, 0.34, 0.5)))
print(math.fsum(range(10)))
print(math.fsum(range(100)))
copy
Output:
0.0 3.0 190.0 1.9000000000000001 45.0 4950.0 [Finished in 0.011339418590068817s]

Each element of the iterable must be an integer or a floating point value, otherwise, a TypeError is raised. 

ExampleEdit & Run
import math

math.fsum([1, 2, 'a'])
copy
Output:
Traceback (most recent call last):   File "<string>", line 3, in <module> TypeError: must be real number, not str [Finished in 0.010215403977781534s]