1 Mar
2008
1 Mar
'08
1:59 a.m.
introducing 'mixed', a module providing a class for handling mixed numbers and fractions. Parses string and float inputs and handles arithmetic correctly. easy_install mixed development version: hg clone http://hg.assembla.com/mixed_pythonmixed_python Homepage and trac: http://trac-hg.assembla.com/mixed_python/
from mixed import Mixed m1 = Mixed('4 2/3') m2 = Mixed('4/10') m2.reduced() Mixed('2/5') m1 + m2 Mixed('5 1/15') print m1 / m2 11 2/3 Mixed(-1.5) Mixed('-1 1/2') Mixed(2./3.) Mixed('2/3')
-- - Catherine http://catherinedevlin.blogspot.com/ *** PyCon 2008 * Chicago * March 13-20 * us.pycon.org ***
6125
Age (days ago)
6125
Last active (days ago)
0 comments
1 participants
participants (1)
-
Catherine Devlin