PYTHON CIRCLE
Practice
Python Books
Archive
Subscribe
Login
Menu
Login
Practice
Python Books
Archive
Subscribe
Blog available for sell
This blog is available for sale. Please 'contact us' if interested.
Advertise with us
Python Multiple Choice Questions
Let A and B be objects of class Foo. Which functions are called when print(A + B) is executed?
A. __add__(), __str__()
B. __str__(), __add__()
C. __sum__(), __str__()
D. __str__(), __sum__()
Show Answer
Next Question
Correct Answer:
A
Explanation: The function __add__() is called first since it is within the bracket. The function __str__() is then called on the object that we received after adding A and B.
© 2024-2025 Python Circle
Contact
Sponsor
Archive
Sitemap