IT 117: Intermediate to Scripting
Answers to Class 21 Ungraded Quiz
-
What do you call the special class of methods that do things
like provide a string representation of an object and convert one
data type into another?
magic methods
-
What is the name of the method that will return a string
representation of an object?
__str__
-
What is the name of the method that allows you
to add two objects together?
__add__
-
What is the name of the method that allows you
to subtract one object from another?
__sub__
-
What is the name of the method that allows you
to multiply two objects together?
__mul__
-
What is the name of the method that allows you
to divide one object by another and get a result of type
float
?
__div__
-
What is the name of the boolean method that allows you
to test whether one object is equal to another?
__eq__
-
What is the name of the boolean method that allows you
to test whether one object is NOT equal to another?
__ne__
-
What is the name of the boolean method that allows you
to test whether one object is greater than another?
__gt__
-
What is the name of the boolean method that allows you
to test whether one object is less than another?
__lt__