return fraction(new_numnew_denf fraction( fraction( print( / the addition method works as we desirebut one thing could be better note that is the correct result but that it is not in the "lowest termsrepresentation the best representation would be in order to be sure that our results are always in the lowest termswe need helper function that knows how to reduce fractions this function will need to look for the greatest common divisoror gcd we can then divide the numerator and the denominator by the gcd and the result will be reduced to lowest terms the best-known algorithm for finding greatest common divisor is euclid' algorithm euclid' algorithm states that the greatest common divisor of two integers and is if divides evenly howeverif does not divide evenlythen the answer is the greatest common divisor of and the remainder of divided by we will simply provide an iterative implementation here note that this implementation of the gcd algorithm only works when the denominator is positive this is acceptable for our fraction class because we have said that negative fraction will be represented by negative numerator def gcd(mn)while ! old_m old_n old_n old_m old_n return print(gcd( )now we can use this function to help reduce any fraction to put fraction in lowest termswe will divide the numerator and the denominator by their greatest common divisor sofor the fraction the greatest common divisor is dividing the top and the bottom by creates new fraction (see listing listing lowest term fractions def __add__(selfother_fraction)new_num self num*other_fraction den self den*other_fraction num new_den self den other_fraction den common gcd(new_numnew_denreturn fraction(new_num /commonnew_den /common introduction