Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program in python 3.x. Please add comments in order to increase understanding of the solution. (If possible try to make the code as simple as
Program in python 3.x. Please add comments in order to increase understanding of the solution. (If possible try to make the code as simple as possible). Thanks
Fractions: You can express a fraction as a tuple: (numerator, denominator) (a) Write a function that adds two fractions that are passed as tuples (b) Write a function that multiplies two fractions that are passed as tuples. HINT: Use the following function gcd(x,y) to help you calculate the Greatest Common Divisor, which you will need to reduce fractions to the simplest form.] def gcd (x, y): To calculate the greatest common divisor of and y" x1 = abs (min(x, y)) y1 = abs (max (x, y)) gcdx1 if y1 % x1: gcd- gcd(x1, y1 % x1) return gcdStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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