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):

Cycle TypeDescription
while loop in the given judgment condition is The loop body is executed when true, otherwise the loop body is exited.
for looprepeating 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:

Control StatementDescription
break statement terminates during statement block execution Loop and jump out of the loop
continue statementterminates the current state during statement block execution Loop, jump out of the loop and execute the next loop.
pass statementpass is an empty statement, for Maintain the integrity of the program structure.

welookups is optimized for learning.© welookups 2018 -
All Right Reserved and you agree to have read and accepted our term and condition