Unformatted text preview: # FIXME: Doesn't check for valid input # Gets numerator and denominator parts2 = fraction2.split('/') fields3 = parts2[0].split() fields4 = parts2[1].split() c = int(fields3[0]) d = int(fields4[0]) # Adds fractions if b == d: num = (a+c) den = b else: num = (a*d)+(c*b) den = (b*d) print("%d/%d + %d/%d = %d/%d" % (a, b, c, d, num, den))...
View
Full Document
 Spring '07
 Amenta
 Fractions, Fraction, valid input

Click to edit the document details