#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2009 Doug Hellmann All rights reserved. # """ """ #end_pymotw_header import fractions f1 = fractions.Fraction(1, 2) f2 = fractions.Fraction(3, 4) print '%s + %s = %s' % (f1, f2, f1 + f2) print '%s - %s = %s' % (f1, f2, f1 - f2) print '%s * %s = %s' % (f1, f2, f1 * f2) print '%s / %s = %s' % (f1, f2, f1 / f2)