Flow Controls
Flow Controls
Flow Controls
1. Python if..else
Flow Control
3. Python while loop
In Python
5. Python pass
Python if...else Statement
if Statement in Python
In control statements, The if statement is the simplest
form. It takes a condition and evaluates to either True or
False.
If the condition is True, then the True block of code will be
executed, and if the condition is False, then the block of
code is skipped, and The controller moves to the next line
Syntax:- if condition:
# body of if statement
If – else statement
The if-else statement checks the condition and executes
the if block of code when the condition is True, and if the
condition is False, it will execute the else block of code.
Syntax:- if condition:
statement 1
else:
statement 2
If – else statement
In Python, the if-elif-else condition statement has an elif
blocks to chain multiple conditions one after another. This
is useful when you need to check multiple conditions.
Syntax:- if condition1:
# code block 1
elif condition2:
# code block 2
else:
# code block 3
Python for Loop
break
continue
Python pass
Vaishnavi Pandey