Python Programming - Objects - Discussion

Discussion Forum : Objects - General Questions (Q.No. 17)
17.
What is the purpose of the __len__ method in Python classes?
To calculate the length of an object
To create a new instance of the class
To define class attributes
To delete the class object
Answer: Option
Explanation:
The __len__ method is used to define the length of an object when the len() function is called.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.