Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 101)
101.
In Python, what is the purpose of the __str__() method in a class?
To define class attributes
To create a new instance of the class
To represent the object as a string for debugging
To provide a human-readable string representation of the object
Answer: Option
Explanation:
The __str__() method is used to provide a human-readable string representation of the object.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.