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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.