[Tutor] Rounding to nearest cent

Brian van den Broek broek at cc.umanitoba.ca
Tue May 22 15:40:04 CEST 2007


Jessica Brink said unto the world upon 05/22/2007 09:08 AM:
> How would I round to the nearest cent when doing calculations with dollar amounts?
>  
> -Jess
> 


Hi Jess,

The decimal module was introduced in large part to facilitate 
financial calculations. Have a look at 
<http://www.python.org/doc/current/lib/module-decimal.html> and see if 
you can get what you need from the docs. If not, ask for more help.

Best,

Brian vdB


More information about the Tutor mailing list