Question: kindly give me a solution for these 2 codes: def __truediv__(self, other): >>> f = Fraction(2,6); g = f / f; g.get_fraction() (12, 12)
kindly give me a solution for these 2 codes:
def __truediv__(self, other):
"""
>>> f = Fraction(2,6); g = f / f; g.get_fraction()
(12, 12)
>>> f, g = Fraction(2,6), Fraction(2,3); h = f / g; h.get_fraction()
(6, 12)
>>> f, g = Fraction(2,6), Fraction(0,5); h = f / g
Traceback (most recent call last):
ZeroDivisionError: 10/0
"""
#
# YOUR CODE HERE
#
pass
def __lt__(self, other):
"""
>>> f, g = Fraction(1,2), Fraction(2,3); f < g
True
>>> f, g = Fraction(1,2), Fraction(2,3); g < f
False
"""
#
# YOUR CODE HERE
#
pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
