Python math.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()
ထပ်၍မရနိုင်သော အရာအားလုံး၏ ပေါင်းလဒ် (tuples၊ arrays၊ lists စသည်တို့) ကို ပြန်ပေးသည်။
အထားအသို
math.fsum(iterable)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
iterable | Required. The list, tuple, array to sum. If the iterable is not numbers, it returns a TypeError |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | float ထပ်ကာထပ်ကာရှိ အရာအားလုံး၏ ပေါင်းစည်းမှုကို ကိုယ်စားပြုသော တန်ဖိုး တစ်ခု |
---|---|
Python ဗားရှင်း- | ၂.၆ |