Python - Magic Methods and Operator Overloading
Which method in Python is used to define the informal string representation of an object, typically for end users, and is called by the
print() function?print() function?__str__ method returns a readable string for users, used by print().__repr__ method returns a detailed string for developers, not usually for printing.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions