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


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.

import math

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)))

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

import math

math.fsum([1, 2, 'a'])