Python math.floor() နည်းလမ်း
ဥပမာ
ဂဏန်းများကို အနီးဆုံးကိန်းပြည့်သို့ အောက်သို့ အဝိုင်းချပါ-
# Import math library
import math
# Round numbers down to the
nearest integer
print(math.floor(0.6))
print(math.floor(1.4))
print(math.floor(5.3))
print(math.floor(-5.3))
print(math.floor(22.6))
print(math.floor(10.0))
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
math.floor()
နည်းလမ်းသည် လိုအပ်ပါက အနီးဆုံးကိန်းပြည့်သို့ ဂဏန်းတစ်ခုအား အောက်သို့လှည့်ကာ ရလဒ်ကို ပြန်ပေးသည် ။
အကြံပြုချက်- ဂဏန်းတစ်ခုအား အနီးဆုံးကိန်းပြည့်အထိ ပတ်ရန် နည်းလမ်းကို ကြည့်ပါ။
math.ceil()
အထားအသို
math.floor(x)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
x | Required. Specifies the number to round down |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | int အဝိုင်းကိန်းဂဏန်းကို ကိုယ်စားပြုသော တန်ဖိုး တစ်ခု |
---|---|
မှတ်တမ်းပြောင်းရန်- | Python 3+ : int တန်ဖိုး တစ်ခု ပြန်ပေးသည် Python 2.x : တန်ဖိုးတစ်ခု ပြန်ပေးသည် float ။ |