How to sum list with floating-point values in Python

1 Answer

0 votes
import math

lst = [1.21, 2.23, 17.87, 0.98, 3.14]

total = math.fsum(lst)

print(total)


'''
run:

25.43

'''

 



answered Sep 14, 2018 by avibootz
...