Python Programming - Polymorphism - Discussion

Discussion Forum : Polymorphism - General Questions (Q.No. 74)
74.
In Python, what is the purpose of the __str__() method in the context of polymorphism?
To customize the behavior when an instance is checked for equality using the == operator
To represent the object as a string for display purposes
To define class attributes
To create a new instance of the class
Answer: Option
Explanation:
The __str__() method is used to provide a human-readable string representation of an object for display purposes.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.