Control Statements

Learning Objectives

By the end of this chapter, you will be able to:

  • Describe the different control statements in Python
  • Control program execution flow using control statements such as if and while
  • Use looping structures in your Python programs
  • Implement branching within looping structures such as for and range
  • Implement breaking out of loops

This lesson describes the Python program flow and how we can change the flow of execution using control statements such as if, while, for, and range.

Introduction

Previously in this book, we covered the following topics:

  • The Python interpreter
  • Python syntax
  • Values and data types

In this chapter, we are going to build on the knowledge that we have acquired so far to dive deeper ...

Get Python Fundamentals 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.