JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Ch. 13 Quiz
Sign in to Google
to save your progress.
Learn more
* Indicates required question
To define a special method for addition, what should we do?
*
1 point
def __add__(self, other):
def add(self, other):
def __add__:
def add:
What argument is needed when making a class' special methods (and really all methods)?
*
1 point
other
class
self
None of the above, you don't need arguments in a class' methods
Would def __blahblahblah__(self, other): ... create special method?
*
1 point
Yes, because it has the two underscores on both sides of the function name.
No, because it is not an accepted special method.
Maybe
If I wanted to pass parameters to a class or create a constructor for a class, which special method do I use?
*
1 point
the __lt__ special method
the __eq__ special method
the __add__ special method
the __init__ special method
Submit
Clear form
Forms
This form was created inside of Irvine LIGHTS.
Report Abuse
Terms of Service
Privacy Policy
Help and feedback
Help Forms improve
Report