if in Python | if else in Python | if elif in Python | nested if in Python | CBSE | flow control

Опубликовано: 23 Июль 2023
на канале: SA Educational Hub
37
2

In this Python tutorial for beginners, we will learn If statement in Python. This Python tutorial video covers: simple if statement, if else statement, if elif statement, and nested if statement. We have discussed these four different types of if statements with examples.
If in Python :
The if statement in Python is a powerful decision making statement and used to control the flow of execution of statements.
It is basically a two-way decision statement.
The if statement allows the computer to evaluate the condition first and then, depending on whether the value of the condition is true or false, it transfers the control to a particular statement.
The different forms of if statements are:
1. Simple if statement
2. The if...else statement
3. The if - elif statement
4. The nested if statement.
1. Simple if statement:
The most common type of flow control statement is the if statement.
An if statement tests a condition, and if this condition is True, the block following the if statement will execute. The block is skipped if the condition is False.
2. If else :
An if clause can optionally be followed by an else statement.
An else statement doesn’t have a condition, and in code, an else statement always consists of
• The else keyword
• A colon
• Starting on the next line, an indented block of code (called the else clause)

3.if elif
An elif statement always consists of :
• The elif keyword
• An expression that evaluates to True or False
• A colon
• Starting on the next line, an indented block of code (called the elif clause)
4. Nested if statement:
An if statement can be inside another if or elif or else statement to form a nested if statement.

Link to Data types in Python:
   • Data Types in Python | Numeric | Stri...  
Links to other videos:
Channel :
   / @saeducationalhub5697  

Indentation in Python
   • Indentation in Python | Python Indent...  
Errors in Python
   • Errors in Python | Syntax Errors | Lo...  
Accepting input from user
   • Accepting input from the console in P...  
Type conversion:
   • Type conversion in Python | Implicit ...  

Data types in Python:
   • Data Types in Python | Numeric | Stri...  
Operator precedence:
   • Operator Precedence in Python | Assoc...  
Evaluation of expression:
   • Evaluation of Expressions in Python |...  
Mutable and immutable:
   • Mutable and Immutable in Python | dif...  
String data type
   • String data type in Python | String i...  
List data type in Python:
   • List data type in Python | List | Lis...  
Tuple data type in Python:
   • Tuple data type in Python | Tuple | T...  
Dictionary data type:
   • Dictionary data type in Python | Dict...  
Boolean data type
   • Boolean data type in Python | Boolean...  
Comments
   • Python Comments | Comments in Python ...  
Rvalue and Lvalue
   • Lvalue and Rvalue | Lvalue and Rvalue...  
Python variable
   • Python Variables | Variables in Pytho...  
Identity operators in Python
   • Identity operators in python | is ope...  
Operators in python
   • Operators in Python | Arithmetic | Co...  
Literals in Python:
   • Literals in Python | String Literals ...  
Introduction To Python:
   • Introduction To Python | what is pyth...  
Features of Python
   • Features of Python | Python Tutorial ...  
Install python on Android
   • How To Install Python On Android|Pyth...  
Compiler Vs Interpreter
   • compiler vs interpreter | difference ...  
Hello World in python:
   • Hello World in python | Interactive m...  
Print Vs sys.stdout.write
   • print vs sys.stdout.write in python |...  
What does print return
   • What does print () return in python |...  
Character set in Python
   • Python Character Set | Python Tokens|...  
Identifier
   • Identifiers in Python | Python Tutori...  
Keywords
   • Keywords in Python | Python Tutorial ...  
What does print return
   • What does print () return in python |...  
What is a data type in Python
   • What is a data type in Python | Diffe...  

#pythontutorial
#python
#cbse
#cbseclass11
#cbseclass12
#cbsepython
#pythonprogramming
#learnpython
#pythontutorialforbeginners
#pythonlanguage