Generators
You’ll learn about the concept of generators in Python in this lesson.
We'll cover the following...
Introduction to generators
Generators are functions that return an iterator. One kind of generator looks just like a list comprehension, except that the enclosing brackets are replaced by parentheses. Generators may be used wherever an iterator may be used, in a for
loop for example.
Here’s an example. It will print e e a o.
Access this course and 1400+ top-rated courses and projects.