Iterables and For Loops

Learn about iterables and how to iterate over them. Also, find out how a for loop works with iterables and iterators.

We'll cover the following

What is an iterable?

An iterable is something that you can iterate over. For example, lists are iterables (so are strings and tuples).

An iterable can be passed to the built-in iter function. This function returns an iterator that you can use to do the actual iterating. Here is an example:

Get hands-on with 1400+ tech skills courses.