Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Iterables and Iterators

Python for loops follow this general form:

for <var> in <iterable>:
    <statement(s)>

In this lesson, you’ll learn how a for loop can be used to iterate or loop over objects such as sets, lists, strings, and dictionaries. You’ll also see that not every Python object can be iterated over, for example integers and floats don’t support iteration. In the next lesson, you’ll learn what an iterator actually is.

Comments & Discussion

Become a Member to join the conversation.