Skip to main content

A Byte of Py: For Loops


(Updated: )

Note: This blog came from an older one. It was a video, but I can’t find it anymore so you’ll have to settle on a gif.

This is the first of a new series “A Byte of Py” where I share tasty Python concepts in around 256 seconds (for the video that is). I had this post planned for a long time and I’m only getting to it now, so it might not be the best. Enjoy 🙂

In this Byte of Py, I’ll explain how for loops work in Python using the range statement, enumerate, dictionaries and enhanced for loops in addition to the for-else construct.

A gif illustrating how for loops work

Here’s a handy GIF explaining how for loops work.