On Aug 10, 1:19 am, Mensanator <[EMAIL PROTECTED]> wrote:
> On Aug 9, 6:31 am, Will Rocisky <[EMAIL PROTECTED]> 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

But:
>>> print '%.0e' % 176.1
2e+002

Giving the Subject ("How to round a floating point to nearest 10?"),
there's a strong presumption that the OP would want the answer to be
180, not 200.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to