Python math.copysign() နည်းလမ်း
ဥပမာ
ပထမဘောင်၏တန်ဖိုးနှင့် ဒုတိယကန့်သတ်ဘောင်၏ လက္ခဏာကို ပြန်ပေးပါ။
#Import math Library
import math
#Return the value of the first
parameter and the sign of the second parameter
print(math.copysign(4, -1))
print(math.copysign(-8, 97.21))
print(math.copysign(-43, -76))
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
နည်းလမ်းသည် ပထမ math.copysign()
ဘောင်၏တန်ဖိုးနှင့် ဒုတိယဘောင်မီတာ၏ အမှတ်အသား (+/-) ပါဝင်သော မျှော့တစ်ခုကို ပြန်ပေးသည်။
အထားအသို
math.copysign(x, y)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
x | Required. A number. The return will have the value of this parameter |
y | Required. A number. The return will have the sign (+/-) of this parameter |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ပထမဘောင်၏တန်ဖိုးနှင့် ဒုတိယကန့်သတ်ဘောင်၏ သင်္ကေတ ပါရှိသော float တန်ဖိုးတစ်ခု |
---|---|
Python ဗားရှင်း- | ၂.၆ |