What is the difference between an iterable and an iterator in Python?
Correct answer
D. An iterator implements __next__; an iterable provides __iter__
6 views
D. An iterator implements __next__; an iterable provides __iter__
6 views
Iterables return an iterator from __iter__; iterators produce values with __next__.
Asked in: Python Interview Advanced Python
https://docs.python.org/3/library/index.htmlNot sure why the answer is D? Ask here and get an explanation.