Table of Contents
In all the programs we have written till now, we have a set of steps in an order (formally referred to as an algorithm) and Python faithfully executes them in the same order. What if you wanted to change this flow of the program? For example, I want to write a program that says Good Morning or Good Evening depending on the time of the day. To achieve this, we need some way to control the flow of our program.
There are three types of control flow statements in Python -
if
, for
and
while
.