19 Mar Wednesday 17:00 Python Practice – 23.03.15.
Question:
We have known the __add__(self, other) to get called on add operation using+ operator, please finish the following math methods of Fraction class:
- __sub__(self, other) To get called on subtraction operation using – operator.
- __mul__(self, other) To get called on multiplication operation using * operator.
- __truediv__(self, other) To get called on division operation using / operator.
- and also the Fraction class can use mixed fraction, For example, 2 1/3 is a mixed fraction
Sorry, the comment form is closed at this time.