[newbie] decimal precision
Eric B.
sitric at home.com
Thu Sep 9 12:53:36 EDT 1999
>>> round(3.0/7 , 3) # the ,3 denotes 3 decimal places
0.429
-Eric B. (sitric at home.com)
Neil Conway wrote:
> Hello all.
>
> I was wondering if anyone knows how to limit decimal precision in
> Python. Here is an example of where my problem occurs:
>
> >>> 3.0 / 7
> 0.428571428571
>
> Lets say I wanted to limit the value it returns to 3 decimal places, for
> example. How would that be done?
>
> Thanks in advance,
>
> Neil Conway
More information about the Python-list
mailing list