You probably think of else as something you can put after an if statement.
And it is!
But in Python, you can also put an else block after a loop!
Here's a for loop with an else statement attached to it:
This is a premium topic available only to active Python Morsels subscribers.
You can find free reading material on the topics page.
Login to view this page
What's Python Morsels?
Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.