Difference between rounding using Decimal library and rounding using round() function in Python 3. I don't know whether to use the round() function or use the Decimal library to round numbers
Decimal
from decimal import*
getcontext().prec = 3
print(Decimal(10)/3)
3,33
round()
print(round(10/3,2))
3,33
I hope everyone can answer my questions
round()always take argument as an integer, while you can pass string inDecimal()You can pass
Decimalobject in round function as well.round()documentation https://docs.python.org/3/library/functions.html#roundDecimal()documentation https://docs.python.org/3/library/decimal.html#decimal-objects