An iterator is an object that contains a countable number of values. An iterator is an object that can be iterated upon, meaning that you can traverse through all the values. Technically, in Python, an iterator is an object which implements the iterator protocol, which consist of the methods __iter__() and __next__().
Lists, tuples, dictionaries, and sets are all iterable objects. They are iterable containers which you can get an iterator from. All these objects have a iter() method which is used to get an iterator. You can also loop through iterator.
mytuple = ("learn", "python", "language") myit = iter(mytuple) print(next(myit)) print(next(myit)) print(next(myit)) #Loop through iterator for x in mytuple: print(x)
This will output