पायथन गणित। fsum () विधि
उदाहरण
सभी मदों का योग लौटाएं:
# Import math Library
import math
# Print the sum of all items
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]))
परिभाषा और उपयोग
math.fsum()
विधि किसी भी पुनरावर्तनीय (टुपल्स, सरणियों, सूचियों, आदि) में सभी वस्तुओं का योग लौटाती है ।
वाक्य - विन्यास
math.fsum(iterable)
पैरामीटर मान
Parameter | Description |
---|---|
iterable | Required. The list, tuple, array to sum. If the iterable is not numbers, it returns a TypeError |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक float मान, चलने योग्य में सभी मदों के योग का प्रतिनिधित्व करता है |
---|---|
पायथन संस्करण: | 2.6 |