Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python and Money
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
You can’t perform that action at this time.