Beginner Python
Q39 / 101

What is the purpose of the __str__ method?

Correct! Well done.

Incorrect.

The correct answer is B) To define a human-readable string representation of an object

B

Correct Answer

To define a human-readable string representation of an object

Explanation

__str__ is called by str() and print(). Defining it makes your objects display meaningfully.

Progress
39/101