Python Programming - Classes - Discussion
Discussion Forum : Classes - General Questions (Q.No. 20)
20.
In Python, what is the purpose of the
__iter__
method in a class?
Answer: Option
Explanation:
The
__iter__
method is used to initialize an iterator for a class. It should return an object that implements the __next__
method, allowing the class to be used in a for
loop.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers