Python Conditional Statements – IF ELSE ka Sach & Har Real Use Case!
📌 Video Focus:
if
,else
,elif
ka structure- Real-life relatable examples
- Python ke indentation rules
- Nested conditions
pass
keyword- Internal working — kaise Python decision leta hai
🎉 Intro
"To bhaiyo, last video me humne variables aur data types ki duniya ko explore kiya.
Ab time hai computer ko decision lene sikhane ka!
Matlab agar user ki age 18 se upar hai to allow karo, warna entry band!
Ye sab aata hai Python ke Conditional Statements me.
Aaj ke video me hum if, else, elif ka poora breakdown karenge — real life examples ke sath — aur bataenge Python kaise decision leta hai internally."
🧠 Section 1: What Are Conditional Statements?
"Conditional statements matlab decision making.
Aapne dekha hoga:
- Agar battery kam hai to phone alert deta hai
- Agar password galat hai to error milta hai
- Agar user premium hai to ads hata do
Ye sab programming me kaise likhte hain — isi ko bolte hain conditionals."
🔍 Section 2: Python If-Else Syntax
age = 18
if age >= 18:
print("You can vote!")
else:
print("Sorry, you're underage.")
"Python me curly braces {} nahi hote jaise JavaScript me.
Yahan indentation (space) matter karta hai.
Colon
:
lagana mandatory hai — aur block ke andar ka code proper space se indent hota hai."
⚠️ Visual Tip: "IndentationError" ka popup dikhana for fun!
⟲ Section 3: Elif – Else If ka Pyar
marks = 85
if marks >= 90:
print("A grade")
elif marks >= 75:
print("B grade")
elif marks >= 60:
print("C grade")
else:
print("Fail")
"Elif ka matlab hi hai 'else if' — jaise options ke line me check karna.
Pehla match milte hi wo block run hota hai, baaki check nahi karta."
🎯 Section 4: Real Life Use Case – Login Check
username = "admin"
password = "1234"
if username == "admin" and password == "1234":
print("Login successful")
else:
print("Invalid credentials")
"Real world me backend authentication aise hi hoti hai.
Aur
and
,or
,not
jaise logical operators bhi yahan kaam aate hain."
⚡ Tip:
and
➔ dono conditions true honi chahiyeor
➔ ek bhi true ho to chaleganot
➔ ulta karega result
🧬 Section 5: Nested If
age = 20
has_voter_id = True
if age >= 18:
if has_voter_id:
print("You can vote")
else:
print("Apply for voter ID first")
"If ke andar if lagake step by step decision making hoti hai."
pass
Keyword
Section 6: if True:
pass
"Agar abhi koi kaam nahi hai kisi block me, lekin syntax complete karna hai, to
pass
keyword lagate hain."
🧠 Section 7: Internal Working of Python Conditions
"Python jab if dekhta hai to condition evaluate karta hai:
- True mila to block execute karta hai
- False mila to agla check karta hai ya else me chala jata hai
Python me kuch values default False hoti hain."
Examples:
if "": # False
if 0: # False
if []: # False
if None: # False
"Agar koi value empty ya zero hai to Python usse False maanta hai."
🚀 Outro & Teaser for Next
"To bhai ab tum Python ko decision lena sikha chuke ho!
Humne seekha:
if
,else
,elif
ka use- Logical operators
- Login jaise real examples
- Nested conditions
- Internal working
Agla video aur bhi dhamakedar hoga — kyunki hum explore karenge Python ke Operators
- Arithmetic
- Comparison
- Logical
- Assignment
- Identity aur Membership operators
Aur har operator ka real-world example bhi dekhne ko milega! 💥
Channel ko subscribe karlo, aur YouTube ke comment section me batana ki tumhara favourite condition wala example kaunsa tha! 🚀"