Python Control Flow Statements
A control flow in a programming language is a block of code that analyse order of execution and chooses a control in which to go based on given arguments (values and logic). In simple sentence, a control flow is just a decision that the system makes. Without Control Flow, a source code is simply a list of statements.
Control flow of a programming language is accomplish with three basic set of control structures:
Sequential statements are always execute the same sequence of commands and it will always output the same results.
Selection statements, often referred to as if...else statements that permit the developer to execute certain section of code depending on some Boolean condition.
- if statements
- if....else statements
- if..elif..else statements
- nested if statements
Repetition in Python used for looping, i.e. repeatedly perform some code block.
- while loop
- do..while loop
- for loop
More on.... Python control structures