Python Loop Statements
This chapter will introduce Python's loop statements. In general, programs are executed sequentially.
Programming languages provide various control structures that allow for more complex execution paths.
Loop statements allow us to execute a statement or group of statements multiple times. The following is the general form of a loop statement in most programming languages:

Python provides the for loop and the while loop (there is no do..while loop in Python):
| Loop Types | Description |
|---|---|
| while loop | Execute the loop body when the given condition is true; otherwise, exit the loop body. |
| for loop | Repeatedly execute statements |
| Nested loops | You can nest a for loop inside the while loop body. |
Loop Control Statements
Loop control statements can change the order in which statements are executed. Python supports the following loop control statements:
| Control statements | Description |
|---|---|
| break statement | During the execution of a statement block, terminate the loop and break out of the entire loop. |
| continue statement | During the execution of a statement block, terminate the current loop, break out of this iteration, and execute the next loop iteration. |
| pass statement | pass is an empty statement, used to maintain the integrity of the program structure. |