Open this example in the interactive library
Source code
from decimal import Decimal, localcontext
with localcontext() as context:
context.prec = 5
print(Decimal(1) / Decimal(7))Sample output
0.14286

Open this example in the interactive library
from decimal import Decimal, localcontext
with localcontext() as context:
context.prec = 5
print(Decimal(1) / Decimal(7))0.14286