In general, the instructions in the program are executed sequentially. Initially the first instruction get executed then followed by the immediate instruction and so on. It is easy to execute a single instruction but what if there are hundreds of instructions!!!. For this, the programming languages are providing different control structures.
A loop statement makes possible to execute one (or more) instruction multiple times. Execution of this loop will continue as long as the condition becomes true and exits from that loop if the condition becomes false.
Python programming provides the following types of loops.
- while loop
- for loop
- nested loops
Python also supports Loop control statements which will change the execution from its normal sequence. Those are: