Open this example in the interactive library
Source code
from decimal import Decimal, ROUND_HALF_UP
print(Decimal('1.005').quantize(Decimal('0.01'), rounding=ROUND_HALF_UP))Sample output
1.01

Quantize money with an explicit rounding rule in Python.
Open this example in the interactive library
from decimal import Decimal, ROUND_HALF_UP
print(Decimal('1.005').quantize(Decimal('0.01'), rounding=ROUND_HALF_UP))1.01