Created
April 16, 2012 13:59
-
-
Save mrchilds/2399003 to your computer and use it in GitHub Desktop.
Python and Money
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Work out total and then round up to 2 decimal places WITHOUT dropping the final zero.... | |
from decimal import * | |
cost = "12.56896" | |
cost = Decimal(cost).quantize(Decimal('.01'), rounding=ROUND_UP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment