Using fractions instead of floats

Terry Reedy tjreedy at udel.edu
Sun Sep 30 23:47:29 EDT 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