Use round(value, 2) when you need a numeric result rounded to two decimal places. For example, round(3.14159, 2) returns 3.14. If you need exactly two digits for display, including a trailing zero, format the value instead: f'{value:.2f}'. For decimal-sensitive arithmetic, use Decimal and quantize().
Use round() for a numeric result
The built-in round(number, ndigits) function rounds a number to the requested number of digits after the decimal point when ndigits is positive. Pass 2 for two places:
value = 3.14159
rounded = round(value, 2)
print(rounded) # 3.14
The result remains a number, which is useful for subsequent calculations. Omitting the second argument, as in round(value), rounds to an integer instead. Python’s built-in rounding uses ties-to-even when a value is exactly halfway between two choices: for example, round(0.5) is 0 and round(1.5) is 2. See the Python 3.14.8 built-in functions documentation.
Why can round(2.675, 2) return 2.67?
Python’s usual float type stores numbers in binary floating-point, and many decimal fractions cannot be represented exactly in binary. The float stored for the literal 2.675 is slightly below the exact decimal value, so round(2.675, 2) produces 2.67. This reflects the stored value, not a defect in round(). The Python floating-point tutorial explains the representation issue.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Choose the method for your goal
| Goal | Use | What you get |
|---|---|---|
| Round for further numeric calculations | round(value, 2) |
A number; exact halfway cases use ties-to-even, and float representation may affect the result. Python documentation |
| Perform decimal-sensitive arithmetic | Decimal('...').quantize(Decimal('0.01')) |
A decimal value with two fractional places; the active or specified decimal rounding mode applies. Python decimal documentation |
| Display exactly two digits | format(value, '.2f') or f'{value:.2f}' |
Text with two digits after the decimal point, including trailing zeros. |
Format a value when the digits are for display
Rounding a number does not guarantee that it will be displayed with two trailing digits. To display 3.1 as 3.10, use a fixed-point format:
value = 3.1
print(f'{value:.2f}') # 3.10
print(format(value, '.2f')) # 3.10
These formatting operations produce strings, not numbers for arithmetic. Keep the numeric value for calculations and format it when presenting output.
Rank #2
Use Decimal when decimal rules matter
For amounts or other decimal-sensitive calculations, construct a Decimal from the original decimal text, then quantize it to the exponent 0.01:
from decimal import Decimal
amount = Decimal('2.675')
rounded_amount = amount.quantize(Decimal('0.01'))
print(rounded_amount) # 2.68
With the default decimal context, this example uses ROUND_HALF_EVEN. quantize() follows the active context’s rounding mode unless you specify a mode; select one explicitly if your application requires a different rule. Do not pass a float when you mean the original decimal input: Decimal(2.675) carries in the float’s approximation, while Decimal('2.675') represents that decimal text exactly. The Python decimal documentation describes construction, quantization and rounding modes.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




