Control structures in Python

Lesson#13

Control structures are the building blocks that define how a Python program executes. They allow you to control the flow of your program’s logic by making decisions and repeating code blocks.

There are three types of control structures in Python:

Conditional execution, Loops and Functions.

Conditional Execution

Conditional execution means that execution of certain statements is based on a condition. If a condition comes true, a set of statements is executed otherwise not.

The conditional execution statements are:

if, if-else, if-elif-else

Loops

These structures allow you to repeat a block of code a specific number of times or until a condition is met. There are two main loop types i.e.

for and while

Functions

Functions are explained in detail in the coming lessons.

--

--