September 2026
1051 pages
35h 4m
English
A control structure is a construct for controlling the program flow. There are two types of control structures in Python: loops and conditionals. Loops are used to execute a block of code multiple times. Conditionals, on the other hand, tie a block of code to a condition. Python knows two subtypes each of loops and conditionals, which will be described in the following sections.
Control structures can be nested within each other in any way. The indentation depth grows continuously in the process.
In Python, there are two types of conditionals: the classic if statement,[ 13 ] and conditional expressions as an additional way of conditionally executing code. We’ll discuss both types of conditionals in detail ...
Read now
Unlock full access