Python Series – Part 5: Python ke Operators (Full Guide)
📌 Video Focus:
- Python ke 7 types ke operators
- Har ek ka syntax, example, real-life analogy
- Logical difference between
==
,is
,in
- Bonus: Type coercion aur truthy/falsy concept quick recap
🎉 Introduction
"To bhai, pichle video me humne sikha Python me decision lena kaise hota hai.
Lekin agar condition likhni ho to usme
==
,>
,<
ye sab kya hote hain?Aaj ke video me hum deep dive karenge Python ke Operators me — bina confuse hue, real-life examples ke sath."
🔢 Section 1: Arithmetic Operators
"Jaise maths me plus, minus, multiply hota hai, waise hi programming me bhi."
Operator | Use | Example |
---|---|---|
+ |
Addition | 2 + 3 = 5 |
- |
Subtraction | 5 - 2 = 3 |
* |
Multiplication | 3 * 4 = 12 |
/ |
Division | 10 / 2 = 5.0 |
// |
Floor Division | 10 // 3 = 3 |
% |
Modulus | 10 % 3 = 1 |
** |
Exponent | 2 ** 3 = 8 |
"Shopping app me price calculation, EMI calculations sab me arithmetic operators lagte hain."
🧠 Section 2: Comparison / Relational Operators
"Jab Python ko compare karwana ho — tab ye use aate hain."
Operator | Use | Example |
---|---|---|
== |
Equal to | 5 == 5 → True |
!= |
Not equal to | 5 != 4 → True |
> |
Greater than | 7 > 3 |
< |
Less than | 2 < 8 |
>= |
Greater than or equal to | 7 >= 7 |
<= |
Less than or equal to | 5 <= 5 |
"Dhyan rahe:
=
assign karta hai,==
compare karta hai."
"Age check, marks comparison, discount logic me inka use hota hai."
⚡ Section 3: Logical Operators
"Multiple condition check karne ke liye and, or, not ka use hota hai."
if age >= 18 and has_voter_id:
print("You can vote")
if not is_logged_in:
print("Please login")
Operator | Meaning |
---|---|
and |
Dono true hone chahiye |
or |
Koi ek bhi true ho |
not |
Result ulta kar deta hai |
"Login + subscription jaise real world checks yahi handle karte hain."
📦 Section 4: Assignment Operators
"Jab kisi variable me value assign ya update karni hoti hai."
Operator | Use | Example |
---|---|---|
= |
Assign | a = 5 |
+= |
Add and assign | a += 3 |
-= |
Subtract and assign | a -= 2 |
*= |
Multiply and assign | a *= 4 |
/= |
Divide and assign | a /= 2 |
"Counters, scores, balance update, yahi sab assignment operations se hota hai."
🧬 Section 5: Identity Operators
"Python me
==
auris
alag cheezein hain."
a = [1, 2, 3]
b = a
c = [1, 2, 3]
print(a == c) # True
print(a is c) # False
print(a is b) # True
"
==
value compare karta hai, jabkiis
memory location."
"Isme dikkat tab aati hai jab same value hone ke bawajood objects alag memory me store ho."
🔍 Section 6: Membership Operators
"Check karna hai koi item kisi group me hai ya nahi?"
fruits = ['apple', 'banana', 'mango']
if 'banana' in fruits:
print("Yes")
Operator | Use |
---|---|
in |
Check existence |
not in |
Check non-existence |
"Search bar, access control, validations sab me membership operator use hota hai."
🛠️ Section 7: Bitwise Operators
"Ye thoda advanced hai — mostly hardware ya optimization me use hote hain."
Operator | Meaning |
---|---|
& |
AND |
` | ` |
^ |
XOR |
~ |
NOT |
<< |
Left Shift |
>> |
Right Shift |
"Detail me jab hum optimization aur low-level computing karenge tab aur seekhenge."
🔖 Section 8: Bonus – Truthy and Falsy Values
"Python me kuch values by default False hoti hain."
if 0: # False
if "": # False
if []: # False
if {}: # False
if None: # False
"Empty values, zero, None sab False treat hote hain — isko yaad rakhna bugs se bachne ke liye."
🚀 Outro & Next Video Teaser
"To bhai, aaj ke video me humne poore Python Operators ko cover kiya:
- Arithmetic
- Comparison
- Logical
- Assignment
- Identity
- Membership
- Bitwise (Intro)
Agla video hoga sabse zyada mazedaar — Loops!
Repeat hone wale tasks, automation, games sab loops se hi possible hote hain.
So ready raho, milte hain next part me! 🔥"