Python If Else in Hindi Explained | Complete Python Course Episode 17
```html
Python If Else in Hindi | เคธเคถเคฐ्เคค เคเคฅเคจ (Conditional Statements) เคो เคธเคฎเคें
Python เคช्เคฐोเค्เคฐाเคฎिंเค เคฎें Conditional Statements (เคธเคถเคฐ्เคค เคเคฅเคจ) เคธเคฌเคธे เคฎเคนเคค्เคตเคชूเคฐ्เคฃ concepts เคฎें เคธे เคเค เคนैं। เคเคธ เคฒेเค เคฎें เคนเคฎ if, elif, เคเคฐ else statements เคो เคตिเคธ्เคคाเคฐ เคธे เคธเคฎเคेंเคे เคเคฐ Complete Python Course เคे Episode 17 เคे เคเคงाเคฐ เคชเคฐ practical examples เคे เคธाเคฅ เคธीเคेंเคे।
Python If Else เค्เคฏा เคนै?
Conditional Statements เคा เคเคชเคฏोเค เคเคฐเคे เคนเคฎ เค เคชเคจे เคช्เคฐोเค्เคฐाเคฎ เคฎें decision-making เคी เคธुเคตिเคงा เคोเคก़ เคธเคเคคे เคนैं। เคฏाเคจी เคि, เค เคฒเค-เค เคฒเค เคชเคฐिเคธ्เคฅिเคคिเคฏों เคฎें เค เคฒเค-เค เคฒเค code เคो execute เคिเคฏा เคा เคธเคเคคा เคนै।
Python เคฎें เคฎुเค्เคฏ เคฐूเคช เคธे เคคीเคจ เคช्เคฐเคाเคฐ เคी conditional statements เคนोเคคी เคนैं:
- if statement - เคเคฌ เคोเค condition true เคนो เคคो code execute เคเคฐเคจा
- elif statement - multiple conditions เคो check เคเคฐเคจा (else if)
- else statement - เคเคฌ เคोเค เคญी condition true เคจ เคนो
Basic If Statement เคा เคเคชเคฏोเค
if statement เคा เคธเคฌเคธे เคธเคฐเคฒ เคเคชเคฏोเค เคนै เคिเคธी condition เคो check เคเคฐเคจा। เค
เคเคฐ เคตเคน condition true เคนै, เคคो code block execute เคนोเคा।
Syntax:
if condition:
# เคฏเคนाँ code เคฒिเคें เคो execute เคนोเคा
# เค
เคเคฐ condition true เคนै
เคเคฆाเคนเคฐเคฃ 1: เคธเคฐเคฒ If Statement
age = 18
if age >= 18:
print("เคเคช adult เคนैं")
เคเคเคเคชुเค:
เคเคช adult เคนैं
เคเคชเคฐ เคฆिเค เคเค เคเคฆाเคนเคฐเคฃ เคฎें, age เคी value 18 เคนै। เคूंเคि age >= 18 condition true เคนै, เคเคธเคฒिเค print() statement execute เคนुเค।
If-Else Statement เคा เคเคชเคฏोเค
เคเคฌ เคเคชเคो เคฆो เคตिเคเคฒ्เคช (option) เคे เคฌीเค เคुเคจाเคต เคเคฐเคจा เคนो - เค
เคเคฐ condition true เคนै เคคो เคเค code, เค
เคเคฐ false เคนै เคคो เคฆूเคธเคฐा code - เคคो if-else เคा เคเคชเคฏोเค เคเคฐें।
Syntax:
if condition:
# เค
เคเคฐ condition true เคนै
print("เคฏเคน execute เคนोเคा")
else:
# เค
เคเคฐ condition false เคนै
print("เคฏเคน execute เคนोเคा")
เคเคฆाเคนเคฐเคฃ 2: If-Else Statement
marks = 35
if marks >= 40:
print("เคเคช pass เคนैं")
else:
print("เคเคช fail เคนैं")
เคเคเคเคชुเค:
เคเคช fail เคนैं
เคเคธ เคเคฆाเคนเคฐเคฃ เคฎें, marks เคी value 35 เคนै เค
เคोเค เคिเคช्เคชเคฃी เคจเคนीं:
เคเค เคिเคช्เคชเคฃी เคญेเคें