The for LoopΒΆ

In Python, the for statement allows us to write programs that implement iteration. As a simple example, let’s say we have some friends, and we’d like to send them each an email inviting them to our party. We don’t quite know how to send email yet, so for the moment we’ll just print a message for each friend.

Take a look at the output produced when you press the run button. There is one line printed for each friend. Here’s how it works:

Next Section - Flow of Execution of the for Loop