Use the fraction.py 1.Modify the Constructor for the Fractio
You Are Eligible For 15% Discount This Month!
Use the fraction.py 1.Modify the Constructor for the Fraction class so that GCD is sued to reduce fractions immediately.This means that the __add__ function no longer needs to reduce.2.Implement the remaining simple arithmetic operators (__sub__, __mul__, and __truediv__).3.Implement the remaining relational operators (__gt__, __ge__, __lt__, __le__, and __ne__).4.Modify the constructor for the Fraction class so that it checks to make sure that the numerator and denominator are both integers.If either is not an integer the constructor should raise an exception.
Leave a ReplyWant to join the discussion?
Feel free to contribute!