Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 12)
12.
In Python, what is the significance of the __str__() method in a class?
To create a new instance of the class
To define the class attributes
To provide a human-readable string representation of the object
To access superclass attributes directly
Answer: Option
Explanation:
The __str__() method is used to define a human-readable string representation of an object and is called by the str() function.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.