How to sum a list of float numbers in Python

1 Answer

0 votes
import math

lst = [5.8, 3.14, 9.5, 2.6]

summ = math.fsum(lst)

print(summ) 





'''
run:

21.04

'''

 



answered Jul 23, 2022 by avibootz

Related questions

1 answer 164 views
1 answer 171 views
1 answer 219 views
2 answers 196 views
...