Intermediate
Python
Q52 / 101
What is the difference between __repr__ and __str__?
Correct! Well done.
Incorrect.
The correct answer is B) __repr__ is for unambiguous developer representation; __str__ is for user-friendly display
B
Correct Answer
__repr__ is for unambiguous developer representation; __str__ is for user-friendly display
Explanation
__repr__ should ideally return a string that can recreate the object. __str__ is for human-readable output. If __str__ is missing, Python falls back to __repr__.
Progress
52/101