Iterator in python is an object that is used to iterate over iterable objects like lists, tuples, dicts, and sets. The iterator object is initialized using the iter() method. It uses the next() method for iteration.
_iter(iterable)_ method that is called for the initialization of an iterator. This returns an iterator object
next ( _next_ in Python 3) The next method returns the next value for the iterable. When we use a for loop to traverse any iterable object, internally it uses the iter() method to get an iterator object which further uses next() method to iterate over. This method raises a StopIteration to signal the end of the iteration.
How an iterator really works in python
Hi, I am Lukesh Poddar and I have started this YouTube channel to teach you coding. Please SUBSCRIBE our YouTube channel to get the notification of the videos related to coding, money making tips and the topics which are very necessary for making career.
------------------------------------------------------------------------------------------
SUBSCRIBE LIKE SHARE COMMENT SUPPORT
------------------------------------------------------------------------------------------