On Aug 9, 5:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> Will Rocisky wrote:
> > I want my 76.1 to be rounded to decimal 80 and 74.9 to decimal 70.
> > How can I achieve that?
> >>> help(round)
>
> Help on built-in function round in module __builtin__:
>
> round(...)
>     round(number[, ndigits]) -> floating point number
>
>     Round a number to a given precision in decimal digits (default 0 digits).
>     This always returns a floating point number.  Precision may be negative.
>
> >>> for f in 74.9, 75.0, 75.1:
>
> ...     print "%r --> %r" % (f, round(f, -1))
> ...
> 74.900000000000006 --> 70.0
> 75.0 --> 80.0
> 75.099999999999994 --> 80.0
>
> Peter

thankssss
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to