πŸ“Š Python
Q. Which of the following methods is called when an object is printed?
  • (A) __repr__
  • (B) __str__
  • (C) __format__
  • (D) __print__
πŸ’¬ Discuss
βœ… Correct Answer: (B) __str__

Explanation: `__str__()` is called by `print()` to get a user-friendly string representation.

Explanation by: Mr. Dubey
`__str__()` is called by `print()` to get a user-friendly string representation.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
74
Total Visits
πŸ“½οΈ
11 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate