Python Loop Statement
Looping statements allow us to execute a statement or group of statements multiple times, following the general form of a looping statement in most programming languages:
Python provides a For loop and a while loop (there is no do in Python: While loop):
| Loop Type |
Description |
| While loop |
Executes the loop body when the given judgment condition is true, otherwise exits the loop body. |
| For loop |
Repeating statements |
| Nested loops |
You can nest A for loop in 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 |
Terminates the loop during statement block execution and jumps out of the loop |
| Continue statements |
Terminates the current loop during statement block execution, jumps out of the loop, and executes the next loop. |
| Pass Statement |
Pass is an empty statement in order to maintain the integrity of the program structure. |
python--Loop Statements