Lesson 7Controlling Program Flow with Loops

Python supports a variety of control structures that determine how content in a program will work and interact. This lesson continues the exploration including additional control structures that make creating algorithms possible. The lesson concludes with a discussion of how iteration aids in text processing.

ITERATIONS OVERVIEW

Lesson 5 introduced control structures. These structures are used to “control” the flow of data through an application. Python supports various structures through control statements of sequence, iteration, and selection. In Lesson 5 selection and progression were discussed. The sequence control structure (executed in a sequence statement) is completed one statement after the other. The selection control structure (implemented in a selection statement) executes only after a particular condition is met. Although these types of code statements allow applications to run, in most cases, using only sequence and selection statements would make for very long program code.

In this lesson, a third control structure is introduced: iteration. Iteration, along with iterative code statements, ...

Get Job Ready Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.