Question: The method _ _ cmp _ _ ( self , other ) is implicitly invoked by the relational operators such as < , < =
The method cmpself other is implicitly invoked by the relational operators such as and Create the class Box as described in the previous question. What error message is produced when you compare two instances of this class? Now define the method cmp so that it returns if the value held in the box is less than the value held in the box referenced by the parameter other, is if they are equal, and if the value is greater than the value of other. Test each of the relational operators to see that they now work.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
