1. Arithmetic Operators
Arithmetic operators का उपयोग गणितीय (Mathematical) work के लिए किया जाता है, जैसे- addition (जोड़), subtraction (घटाना), multiplication (गुणा), division (भाग) आदि। नीचे कुछ प्रमुख arithmetic operators हैं |
| Operator | Description | Example |
| + | Addition (जोड़) | a + b |
| – | Subtraction (घटाव) | a – b |
| * | Multiplication (गुणा) | a * b |
| / | Division (भाग) | a / b |
| % | Modulus (शेष) | a % b |
| ** | Exponentiation (घातांक) | a ** b |
| // | Floor Division (पूर्ण भाग) | a // b |
Source Code :
a = 10
b = 20
print(a + b)
2. Comparison Operators
Comparison operators का उपयोग दो values को compare करने के लिए किया जाता है। यह true या false को return करता है।
| Operator | Description | Example |
| == | Equal to (बराबर) | a == b |
| != | Not equal to (असमान) | a != b |
| > | Greater than (बड़ा) | a > b |
| < | Less than (छोटा) | a < b |
| >= | Greater than or equal to (बड़ा या बराबर) | a >= b |
| <= | Less than or equal to (छोटा या बराबर) | a <= b |
Source Code :
a = 10
b = 20
print(a < b)
3. Logical Operators
Logical operators का उपयोग logical statements को जोड़ने के लिए किया जाता है। ये boolean values (True, False) को return करते हैं।
| Operator | Description | Example |
| and | यदि दोनों स्टेटमेंट true हों तो ही true | a and b |
| or | यदि कोई भी एक स्टेटमेंट true हो तो true | a or b |
| not | यह statement को reverse (उल्टा) करता है। | not a |
4. Bitwise Operators
Bitwise operators का उपयोग binary numbers पर operations करने के लिए किया जाता है।
| Operator | Description | Example |
| & | AND | a & b |
| | | OR | a | b |
| ^ | XOR | a ^ b |
| ~ | NOT | ~a |
| << | Left Shift | a << 1 |
| >> | Right Shift | a >> 1 |
5. Assignment Operators
Assignment operators का उपयोग variables को values प्रदान (assign) करने के लिए किया जाता है।
| operators | description | उदाहरण | same as |
| = | यह बायीं तरफ के expression को वैल्यू assign करता है. | x = 5 | x = 5 |
| += | यह right operand को left operand से जोड़ता है तथा जो result आता है उसे left operand को assign करता है. | x += 5 | x = x + 5 |
| -= | यह right operand को left operand में घटाता है तथा जो result आता है उसे left operand को assign करता है. | x -= 5 | x = x – 5 |
| *= | यह right operand को left operand में गुणा करता है तथा जो result आता है उसे left operand को assign करता है. | x *= 5 | x = x * 5 |
| /= | यह left operand को right operand से divide करता है तथा जो result आता है उसे left operand को assign करता है. | x /= 5 | x = x / 5 |
| %= | यह दो operands का modulus लेता है और उसे left operand को assign करता है. | x %= 5 | x = x % 5 |
| **= | यह operands में power (घात) को परफॉर्म करता है तथा उसे left operand को assign करता है. | x **= 5 | x = x ** 5 |
| //= | यह operators में floor division को परफॉर्म करता है तथा उसे left operand को assign करता है. | x //= 5 | x = x // 5 |
6. Identity Operators
Identity operators का उपयोग यह check करने के लिए किया जाता है कि दो variables एक ही memory location को refer करते हैं या नहीं।
| Operator | Description | Example |
| is | यदि दोनों variables समान हों | a is b |
| is not | यदि दोनों variables अलग हों | a is not b |
7. Membership Operators
Membership operators का उपयोग यह check करने के लिए किया जाता है कि कोई value किसी sequence (जैसे list, tuple, string) का हिस्सा है या नहीं।
| Operator | Description | Example |
| in | यदि value sequence में है | a in b |
| not in | यदि value sequence में नहीं है | a not in b |
