Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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....
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 OStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started