Python အော်ပရေတာများ
Python အော်ပရေတာများ
ကိန်းရှင်များနှင့် တန်ဖိုးများပေါ်တွင် လုပ်ဆောင်ချက်များကို လုပ်ဆောင်ရန် အော်ပရေတာများကို အသုံးပြုသည်။
အောက်ပါဥပမာတွင်၊ +
ကျွန်ုပ်တို့သည် တန်ဖိုးနှစ်ခုပေါင်းထည့်ရန် အော်ပရေတာကိုအသုံးပြုသည်-
ဥပမာ
print(10 + 5)
Python သည် အော်ပရေတာများကို အောက်ပါအုပ်စုများတွင် ပိုင်းခြားထားသည်။
- ဂဏန်းသင်္ချာ အော်ပရေတာများ
- Assignment operators များ
- နှိုင်းယှဉ်အော်ပရေတာများ
- ယုတ္တိရှိသော အော်ပရေတာများ
- Identity လို့အော်တယ်။
- အသင်းဝင်လုပ်ငန်းများ
- နည်းနည်းတော့ အော်တယ်။
Python ဂဏန်းသင်္ချာ အော်ပရေတာများ
သင်္ချာဆိုင်ရာ လုပ်ဆောင်ချက်များကို လုပ်ဆောင်ရန်အတွက် ဂဏန်းသင်္ချာအော်ပရေတာများကို ဂဏန်းတန်ဖိုးများဖြင့် အသုံးပြုသည်-
Operator | Name | Example | Try it |
---|---|---|---|
+ | Addition | x + y | |
- | Subtraction | x - y | |
* | Multiplication | x * y | |
/ | Division | x / y | |
% | Modulus | x % y | |
** | Exponentiation | x ** y | |
// | Floor division | x // y |
Python Assignment Operators များ
Assignment operator များကို variable များသို့ တန်ဖိုးများသတ်မှတ်ရန် အသုံးပြုသည်-
Operator | Example | Same As | Try it |
---|---|---|---|
= | x = 5 | x = 5 | |
+= | x += 3 | x = x + 3 | |
-= | x -= 3 | x = x - 3 | |
*= | x *= 3 | x = x * 3 | |
/= | x /= 3 | x = x / 3 | |
%= | x %= 3 | x = x % 3 | |
//= | x //= 3 | x = x // 3 | |
**= | x **= 3 | x = x ** 3 | |
&= | x &= 3 | x = x & 3 | |
|= | x |= 3 | x = x | 3 | |
^= | x ^= 3 | x = x ^ 3 | |
>>= | x >>= 3 | x = x >> 3 | |
<<= | x <<= 3 | x = x << 3 |
Python နှိုင်းယှဉ်အော်ပရေတာများ
နှိုင်းယှဉ်အော်ပရေတာများကို တန်ဖိုးနှစ်ခုကို နှိုင်းယှဉ်ရန် အသုံးပြုသည်-
Operator | Name | Example | Try it |
---|---|---|---|
== | Equal | x == y | |
!= | Not equal | x != y | |
> | Greater than | x > y | |
< | Less than | x < y | |
>= | Greater than or equal to | x >= y | |
<= | Less than or equal to | x <= y |
Python Logical Operators များ
အခြေအနေဆိုင်ရာ ထုတ်ပြန်ချက်များကို ပေါင်းစပ်ရန်အတွက် ယုတ္တိအော်ပရေတာများကို အသုံးပြုသည်-
Operator | Description | Example | Try it |
---|---|---|---|
and | Returns True if both statements are true | x < 5 and x < 10 | |
or | Returns True if one of the statements is true | x < 5 or x < 4 | |
not | Reverse the result, returns False if the result is true | not(x < 5 and x < 10) |
Python Identity Operators
အရာဝတ္တုများ တူညီလျှင်မဟုတ်ဘဲ၊ ၎င်းတို့သည် အမှန်တကယ်တူညီသော အရာဝတ္တုဖြစ်ကြောင်း တူညီသောမှတ်ဉာဏ်တည်နေရာဖြင့် နှိုင်းယှဉ်ရန် Identity operator ကိုအသုံးပြုသည်-
Operator | Description | Example | Try it |
---|---|---|---|
is | Returns True if both variables are the same object | x is y | |
is not | Returns True if both variables are not the same object | x is not y |
Python အသင်းဝင် အော်ပရေတာများ
အရာဝတ္တုတစ်ခုတွင် sequence ကိုပြသခြင်းရှိမရှိစမ်းသပ်ရန်အဖွဲ့ဝင်အော်ပရေတာများကိုအသုံးပြုသည်-
Operator | Description | Example | Try it |
---|---|---|---|
in | Returns True if a sequence with the specified value is present in the object | x in y | |
not in | Returns True if a sequence with the specified value is not present in the object | x not in y |
Python Bitwise အော်ပရေတာများ
Bitwise အော်ပရေတာများကို (ဒွိ) နံပါတ်များကို နှိုင်းယှဉ်ရန် အသုံးပြုသည်-
Operator | Name | Description |
---|---|---|
& | AND | Sets each bit to 1 if both bits are 1 |
| | OR | Sets each bit to 1 if one of two bits is 1 |
^ | XOR | Sets each bit to 1 if only one of two bits is 1 |
~ | NOT | Inverts all the bits |
<< | Zero fill left shift | Shift left by pushing zeros in from the right and let the leftmost bits fall off |
>> | Signed right shift | Shift right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off |