Get up to 60 % extra points for free! More info
Save up to 80 % on our Python e-learning courses. Only this week!

Lesson 2 - Iterators, Generators and Some Functions in Python New

In the last lesson, Python Collections - Tuples and Lists, we learned in depth about working with tuples and lists.

In this lesson, we'll introduce some of the more advanced techniques of functional programming in Python. Let's look at lambda functions, iterators and generators, and a few built-in functions.

Iterators and Generators


Iterators are objects that have the special __next__ method and return a single value each time. Iterators are a subset of iterable objects that have the special __iter__ method. We used iterable objects, for example, in the for loop. But let's go back to the iterators. We create an iterator using the iter() function from an iterable object, such as a list.



...End of the preview...
Continue further

You will gain knowledge worth hundreds of thousands for a few crowns

You've come here and that's great! We believe that the first lessons showed you something new and useful
Do you want to continue the course? Go to the premium section.

Buy just this lesson

Buy only the lesson 10 points
Currently, you have 0 points
You gain 10 points for adding an article to the site, or for $0.90

This article is licensed: Premium, by buying this article, you agree with the terms of use.

What will you get from us in the next lessons?
  • Unlimited and permanent access to individual lessons.
  • High quality IT knowledge.
  • Skills to help you get your dream and well-paid job.

Article description

Requested article covers this content:

In this tutorial we'll take a look at iterators and generators. We'll also deepen our knowledge of comprehensions and learn a few built-in functions.

You gain points by supporting our network. This is done by sending a helpful amount of money to support the site, or by creating content for the network.

Article has been written for you by Shift
As an author I'm interested mainly in industry automation. I'm also writing music and literature. In my spare time I'm working on a few games in Game Maker Studio.
Activities (2)