³ò ¸¥$Ic@sdZddd„ƒYZdS(s™Fraction library, done the 'right' (object-oriented) way. This defines a Fraction data structure and some basic operations. Sean Ho for CMPT14x example tFractioncBsDeZddd„Zd„Zd„Zd„Zd„Zd„ZRS(iicCs?t|ƒ|_t|ƒdjo t‚nt|ƒ|_dS(Ni(tinttnumertZeroDivisionErrortdenom(tselftntd((s%/home/seanho/twu/python/oofraction.pyt__init__ s cCsd|i|ifS(s0Return a string representation of this fraction.s%d / %d(RR(R((s%/home/seanho/twu/python/oofraction.pyt__str__scCs3tƒ}|i|i|_|i|i|_|S(sbMultiply two fractions. Does not reduce the result (i.e., cancel common factors). (RRR(Rtf2tproduct((s%/home/seanho/twu/python/oofraction.pyt__mul__s cCs||S(N((RR ((s%/home/seanho/twu/python/oofraction.pytmultiplyscCs-|idjo t‚nt|i|iƒS(sReturn the reciprocal fraction.i(RRRR(R((s%/home/seanho/twu/python/oofraction.pytinverts cCs|i|iƒƒS(s$Divide by another fraction: self/f2.(R R(RR ((s%/home/seanho/twu/python/oofraction.pyt__div__%s(t__name__t __module__RR R R RR(((s%/home/seanho/twu/python/oofraction.pyRs    N((t__doc__R(((s%/home/seanho/twu/python/oofraction.pyss