Flow of Control in Python

Statements Flow Control: It determines the order of execution of statements in a program.

Types of Statements Flow Control: There are 3 types of flow control in python.
1) Sequential Flow
2) Conditional / Branching / Decision Making / Selection Statements
3) Iteration/ Repetition/ Looping Statements

1) Sequential Flow: In it, statements are executed in sequence one after the other, from top to bottom. In it, statements are executed in sequence in a linear order. Example:

print("welcome to gargs academy")
print("For Math and Computer")
print("Contact at : 9467863365")

Output:

welcome to gargs academy
For Math and Computer
Contact at : 9467863365

2) Conditional Statements: It tests a condition and executes a particular statement or a group of statements depending upon the result of the condition. It is a compound statement i.e. it contains other statements. Python supports following types of conditional statements
1) if
2) if else
3) if elif
4) if elif else
5) Nested if else

3) Looping Statements: It executes a statement or a group of statements repetitively as long as some condition is true. Python supports following types of loops.
1) for loop / counting loop
2) while loop / conditional loop

error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.