# How to Sum all Values in a List or Tuple in Python using fsum() Function

`fsum()` function exists in Standard math Library of Python Programming Language. The purpose of this function is, to sum up, all the values in any iterable (tuples, lists) accurately.

## Syntax of `fsum()` Function in Python

The syntax of `fsum()` function in Python is:
`math.fsum( iterable )`

## `fsum()` Function Parameters

`iterable` – Lists and Tuples containing valid Python numbers as items.

Note: If items in iterable (tuples, lists) are not number, `fsum()` returns an `TypeError`.

Python 2.x – Yes
Python 3.x – Yes

## `fsum()` Function Return Value

`fsum()` returns an accurate sum of any `iterable` as a floating point number.

## Python `fsum()` Function Example

```# import math library
import math

print(math.fsum([25,23,12,56]))
print(math.fsum([.1,.1,.1,.1]))
print(math.fsum((25,23,13,56)))

i =  [1,2,3,4,5,6,7]

print(math.fsum((i)))```

Output of Python `fsum()` function:
``` 116.0 0.4 117.0 28.0```