Python complex() လုပ်ဆောင်ချက်
ဥပမာ
နံပါတ် 3 နှင့် စိတ်ကူးယဉ်နံပါတ် 5 ကို ရှုပ်ထွေးသောနံပါတ်အဖြစ် ပြောင်းပါ
x = complex(3, 5)
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
လုပ်ဆောင်ချက် သည် complex()
နံပါတ်အစစ်အမှန်နှင့် စိတ်ကူးယဉ်နံပါတ်ကို သတ်မှတ်ခြင်းဖြင့် ရှုပ်ထွေးသောနံပါတ်ကို ပြန်ပေးသည်။
အထားအသို
complex(real, imaginary)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
real | Required. A number representing the real part of the complex number. Default 0. The real number can also be a String, like this '3+5j', when this is the case, the second parameter should be omitted. |
imaginary | Optional. A number representing the imaginary part of the complex number. Default 0. |
နောက်ထပ် ဥပမာများ
ဥပမာ
စာကြောင်းတစ်ခုအား ရှုပ်ထွေးသောနံပါတ်အဖြစ် ပြောင်းပါ-
x = complex('3+5j')