A

Admin • 833K Points
Coach

Q. What is true about `__str__()` in a class?

  • (A) It converts the object to an integer
  • (B) It returns a string representation of the object
  • (C) It destroys the object
  • (D) It initializes the object
  • Correct Answer - Option(B)
  • Views: 26
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

`__str__()` defines the string representation of an object when `str()` or `print()` is called.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.