Skip to content

loop works as iterator

In simple words, iterator is an object that can be iterated upon. They contain more than one data in it. Commonly used Python iterators are list, tuple and dictionary. An iterator will return data from that object, one item at a time. Any Python iterator  must implement two methods: The __iter__ method which returns the iterator object  The __next__ method which return the next value for the iterable. How Does Iteration… Read More »What are Iterators in Python

What are Iterators in Python