Python Programming - Objects - Discussion

Discussion Forum : Objects - General Questions (Q.No. 27)
27.
What is the purpose of the __contains__ method in Python classes?
To check if an element is present
To calculate the length of an object
To define class attributes
To delete the class object
Answer: Option
Explanation:
The __contains__ method is used to check if a specified element is present in the object. It is called by functions like in.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.