Select true statements. (select two)
a. An iterator is an object that has a __iter__()
method that returns an iterator object.
b. An iterator is an object that implements the __next__()
method that returns the next element of the iterable object, or throws a StopIteration exception when there are no more elements available.
c. Any function in Python is an iterator.
1 Answers
a. An iterator is an object that has a __iter__()
method that returns an iterator object.
b. An iterator is an object that implements the __next__()
method that returns the next element of the iterable object, or throws a StopIteration exception when there are no more elements available.