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

  • (A) __str__()
  • (B) __init__()
  • (C) __call__()
  • (D) __repr__()
πŸ’¬ Discuss
βœ… Correct Answer: (A) __str__()
Explanation: The __str__() method is used to define the string representation of an object.
Explanation by: Mr. Dubey
The __str__() method is used to define the string representation of an object.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
91
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
83%
Success Rate