What is the purpose of the __str__ and __repr__ methods in a Python class?
__str__ is used for creating string representations of instances, while __repr__ is used for debugging.
__str__ is used for debugging, while __repr__ is used for creating string representations of instances.
Both __str__ and __repr__ serve the same purpose.
__str__ and __repr__ are not valid methods in Python.
This question is part of this quiz :
Python Classes Quiz