Python Loop statement

Source: Internet
Author: User
Tags terminates

Python Looping Statements

This section will introduce you to Python Loop, and the program is executed in order in the general case.

Programming languages provide a variety of control structures that allow for more complex execution paths.

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:

Pythonprovides a forLoops and whileLoops (inPythonnot inDo .. whilecycle):

Loop type

Describe

while Span style= "font-family:" > loop

In a given condition of judgment

for Span style= "font-family:" > loop

repeating statement

nested loops

you can Span style= "font-family:" >while for loop

Loop control Statements

loop control statements can change the order in which statements are executed. Python supports the following loop control statements:

Control statement

describes

break Span style= "font-family:" > statement

continue statement

Terminates the current loop during statement block execution, jumps out of the loop, Executes the next loop.

Pass Statement

Pass is an empty statement in order to maintain the integrity of the program structure.

Python Loop statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.