This chapter will introduce Python's loop, the program is generally executed sequentially.
Programming languages provide various control structures, allows more complex execution paths.
Loop allows us to perform a statement or group of statements repeatedly, the following is the general form in most programming languages of the loop:
Python provides for loop and while loop (no do..while loop in Python):
|Type of cycle
|Loop body is executed at the time of the judgment given condition is true, otherwise exit the loop.
|You can be nested for loop in while loop body
Loop control statements
Loop control statements can change the order of statement execution. Python loop control supports the following statements:
|It terminates the loop during the execution of the statement block and out of the entire cycle
|Termination statement block in the implementation process of the current cycle, jump out of the cycle, the next time through the loop.
|pass is an empty statement, in order to maintain the integrity of the program structure.