Using fractions instead of floats

Terry Reedy tjreedy at udel.edu
Mon Oct 1 05:47:29 CEST 2007


"Andres Riofrio" <andres.j.new at gmail.com> wrote in message 
news:52c50880709302010n7cbc070fn6223bd94a67542dd at mail.gmail.com...
| a question: Is there a way to make 5/2 return something other than an
| integer?

>>> from __future__ import division
>>> 1/2
0.5
>>> 5/2
2.5

tjr






More information about the Python-list mailing list