Python loop statement
This chapter will introduce you to Python's looping statements, which are normally executed in order.
The programming language provides a variety of control structures that allow for more complex execution paths.
The loop statement allows us to execute a statement or group of statements multiple times. The following is the general form of loop statements in most programming languages:
Python provides for loops and while loops (no do..while loops in Python):
|while loop||in the given judgment condition is The loop body is executed when true, otherwise the loop body is exited.|
|for loop||repeating statements|
|nested loop||you can loop inside the while Nested for loop|
Cycle Control Statement
The loop control statement can change the order in which statements are executed. Python supports the following loop control statements:
|break statement||terminates during statement block execution Loop and jump out of the loop|
|continue statement||terminates the current state during statement block execution Loop, jump out of the loop and execute the next loop.|
|pass statement||pass is an empty statement, for Maintain the integrity of the program structure.|