filmov
tv
If....Elif....Else Statement || Conditional Statements in python || Part - 3 #python3 #python

Показать описание
In this video, I have discussed the basic If...elif...else condition in python and its implementation.
Why do we need If....elif....else conditional statements?
'IF' statement will be executed if a certain condition is correct but the else statement will be executed only when IF block is not executed that is when a given condition is wrong. So we cannot have more than one condition in If and else statement so elif was introduced which actually means else if, in which we can write some other condition, that means if our "IF" condition is wrong then the code will execute the "elif" block and there it will check for the other condition and if it also fails then finally else block will be executed.
Because of elif statement we can have infinite conditions in our if..elif..else code.
For example, when do we remove the charger from our mobile?
It is simple when it's 100% charged
similarly in code this logic as:
battery_percentage = 99
if battery_percentage == 100:
print("Charged, please remove the charger")
elif batery_percentage == 50:
print("Halfway and still charging")
else:
print("Still Charging")
Why do we need If....elif....else conditional statements?
'IF' statement will be executed if a certain condition is correct but the else statement will be executed only when IF block is not executed that is when a given condition is wrong. So we cannot have more than one condition in If and else statement so elif was introduced which actually means else if, in which we can write some other condition, that means if our "IF" condition is wrong then the code will execute the "elif" block and there it will check for the other condition and if it also fails then finally else block will be executed.
Because of elif statement we can have infinite conditions in our if..elif..else code.
For example, when do we remove the charger from our mobile?
It is simple when it's 100% charged
similarly in code this logic as:
battery_percentage = 99
if battery_percentage == 100:
print("Charged, please remove the charger")
elif batery_percentage == 50:
print("Halfway and still charging")
else:
print("Still Charging")
Control Flow in Python - If Elif Else Statements
If statements in Python are easy (if, elif, else) 🤔
The if-elif-else Statement in Python
Lesson 9- The basics of if/ elif/ else conditional statements in Python
#19 Python Tutorial for Beginners | If Elif Else Statement in Python
Conditionals: if, elif, else statements | Python for Beginners Lesson 5 | Code with Kylie
IF, ELIF, ELSE | Conditional Statements in Python
Python Tutorial for Beginners 6: Conditionals and Booleans - If, Else, and Elif Statements
ELIF Statements in Python (IF, ELIF, ELSE) - Conditional Statements - Python Tutorial for Beginners
Python Programming Tutorial #4 - IF/ELIF/ELSE
Conditional Statements In Python | if, if-elif, if-elif-else | Python for Beginners
If & If Else Conditional Statements in Python | Python Tutorials for Beginners#lec24
Simple Explanation for If - elif - else statements
Python Learn if, elif, else condition learn (
This is the if-elif-else statement #python #shorts
🧠 Master Python Conditional Statements | If, Elif, Else Explained! | RK IT Arena
Python Conditional Statements | if elif else in Python | Python Decision Control | SuMyPyLab
Python Tutorial #20; Decision or Conditional statements - If Elif Else in Python
Python Conditional Statement Tutorial | Multiple conditional statements with if elif else in python
The 'if-elif-else' Command
Python Tutorial: If, If-Else, and If-Elif-Else Statements Explained
if/elif/else in Python 🐍🚀 #python #code #beginner
Lec-24: If else, elif in Python 🐍 | Nested If | Python for Beginners
Learn Python in Arabic #041 - Control Flow - If, Elif, Else
Комментарии