A

Admin • 833K Points
Coach

Q. Which method is automatically called when an object is converted to a string using str()?

  • (A) __str__()
  • (B) __init__()
  • (C) __call__()
  • (D) __repr__()
  • Correct Answer - Option(A)
  • Views: 33
  • Filed under category Python
  • Hashtags:

Explanation by: Admin

The __str__() method is used to define the string representation of an object.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.