Question: Using Python 3, complete the following exercise.... Exercise 5.3 (fractions.py). Any fraction can be written as the division of two integers. You could express this

Using Python 3, complete the following exercise....

Using Python 3, complete the following exercise.... Exercise 5.3 (fractions.py). Any fractioncan be written as the division of two integers. You could express

Exercise 5.3 (fractions.py). Any fraction can be written as the division of two integers. You could express this in Python as a tuple- (numerator, denominator) For example, the fractions , and can be represented using the tuples (1 , 2), (10, 7), and (499, 10001) Write the following functions: reduce (fraction) This function takes a fraction, reduces it, and returns the result. For ex- ample, reduce(8, 4)) should return (2, 1). To reduce a fraction a/b, divide a and b by their GCD. The result is (a/d)/(b/d). The math module comes with the math.ged function add(fraction1, fraction2) Given two fractions as tuples, add them. multiply(fractioni, fraction2) Given two fractions as tuples, multiply them. divide (fraction1, fraction2) Given two fractions as tuples, divide them These functions should not use input () or print O

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!