🧠 Introduction
🐍 Python Day 5 – If Else Conditions
Ippati varaku manam operators nerchukunnam.
I roju manam decision making (If-Else) nerchukundam.
👉 Program lo condition base chesi decisions tiskovadaniki use avutundi
💡 Example:
Age 18 kanna ekkuva unte → eligible
Lekapothe → not eligible
🔹 Basic If Condition
age = 20
if age > 18:
print("Eligible")
if age > 18:
print("Eligible")
🔹 If-Else Condition
age = 16
if age >= 18:
print("Eligible")
else:
print("Not Eligible")
if age >= 18:
print("Eligible")
else:
print("Not Eligible")
🔹 If-Elif-Else
🧪 Real Example (User Input)
if age >= 18:
print("You can vote ✅")
else:
print("You cannot vote ❌")
⚠️ Important Points
👉 Indentation (space) very important
👉 Colon : compulsory after condition
👉 Conditions lo operators use chestam (> < ==)
🎯 Mini Practice
num = int(input("Enter number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
📌 Summary
✔ If condition nerchukunnam
✔ If-Else & Elif use chesam
✔ Real-time example run chesam
Comments
Post a Comment