Important Notice:

Course Content
The Calendar Module
Library Function/Predefined Functions
0/4
Sys Module
Library Function/Predefined Functions
0/2
OS Module
Library Function/Predefined Functions
0/2
Functions in Python (Chapter-10) M3-R5
About Lesson

Math.fsum():-

               The math.fsum() method returns the sum of all items in any iterable (tuples, arrays, lists, etc.).

Example

Return the sum of all items:

import math

print(math.fsum([1, 2, 3, 4, 5]))

print(math.fsum([100, 400, 340, 500]))

print(math.fsum([1.7, 0.3, 1.5, 4.5]))

Output

15.0

1340.0

8.0

error: Content is protected !!