3. Control Statements

Objectives

In this chapter, you’ll:

Image Make decisions with if, if else and if elif else.

Image Execute statements repeatedly with while and for.

Image Shorten assignment expressions with augmented assignments.

Image Use the for statement and the built-in range function to repeat actions for a sequence of values.

Perform sentinel-controlled iteration ...

Get Python for Programmers 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.