Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 48)
48.
What is the purpose of the __iter__() method in Python classes?
To define class attributes
To create a new instance of the class
To customize the iteration behavior of instances
To access superclass attributes directly
Answer: Option
Explanation:
The __iter__() method is used to customize the iteration behavior of instances of a class when used in a for loop or with the iter() function.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.