How to round a floating point to nearest 10?

Mensanator mensanator at aol.com
Sat Aug 9 17:19:07 CEST 2008


On Aug 9, 6:31�am, Will Rocisky <geekm... at gmail.com> wrote:
> I want my 76.1 to be rounded to decimal 80 and 74.9 to decimal 70.
> How can I achieve that?

>>> print '%.0e' % 74.9
7e+01
>>> print '%.0e' % 76.1
8e+01



More information about the Python-list mailing list