⚙️ Operators
Last Updated: 15th August 2025
Operators are special symbols that perform actions on values or variables.
Example: 5 + 3 — here + adds two numbers.
Hinglish Tip 🗣: Operators ko aise samjho — chhote tools jo numbers/values par kaam karte hain (add, compare, join, etc.).
🧭 Types of Operators
| Category | Operators | Purpose |
|---|---|---|
| Arithmetic | +, -, *, /, //, %, ** | Math calculations |
| Assignment | = | Assign/update variables |
| Compound | +=, -=, *=, /=, %=, **=, //= | Update variables |
| Comparison (Relational) | ==, !=, >, <, >=, <= | Compare values → True/False |
| Logical | and, or, not | Combine/negate conditions |
| Bitwise | &, |, ^, ~, <<, >> | Work at bit level |
| Identity | is, is not | Check same object in memory |
| Membership | in, not in | Check presence in sequence |
✏ Mini Example
a = 7
b = 3
print(a + b) # 10 (Arithmetic)
print(a > b) # True (Comparison)
print((a > 5) and (b < 5)) # True (Logical)
💡 Don’t worry! We’ll explore each of these in full detail in the next sections.