round(number[, ndigits]):

>>> round(0.3223322, 2)
0.32

Note that you’ll probably still want to use a certain precision of string formatting when producing output due to floating point imprecision.

Depending on what you’re trying to achieve, it might be appropriate to use the Decimal type:

>>> from decimal import Decimal
>>> round(Decimal(0.3223322), 2)
Decimal('0.32')

which does its math in (surprise!) decimal instead of binary and therefore doesn’t suffer any issues with decimal rounding (except initially if you’re trying to create it from a float).

Answer from Ry- on Stack Overflow
🌐
DataCamp
datacamp.com › tutorial › python-round-to-two-decimal-places
How to Round to 2 Decimal Places in Python | DataCamp
August 8, 2024 - The round() function is Python’s built-in function for rounding float point numbers to the specified number of decimal places. You can specify the number of decimal places to round by providing a value in the second argument.
Discussions

How to turn a float number like 293.4662543 into 293.47 in python? - Stack Overflow
How to shorten the float result I got? I only need 2 digits after the dot. Sorry I really don't know how to explain this better in English... Thanks More on stackoverflow.com
🌐 stackoverflow.com
Python: Print floating point numbers with two digits after decimal - Stack Overflow
Write a program that asks the user for the price of an item, and then prints out a bill for the item. The bill includes the item price, the sales tax on the item, and the total amount paid by the More on stackoverflow.com
🌐 stackoverflow.com
How to use the float() command to create 2 decimal places instead of one in a product of 2 numbers [the product is dollar amount]
You generally don't round until you go to display the value. You can use round for that, but since you just want to display it with two digits, you can use string formatting . In your case, something like print(f'{totalPay:.2f}'). .2f is the format specifier, saying round the float (f) to two decimal places (.2). More on reddit.com
🌐 r/learnpython
9
7
January 28, 2020
How to remove decimals in float?
If this is just for printing... f'{my_float:.6f}. If you actually need that level of precision, you're likely to run into rounding issues, but you could try something like this: int(my_float * (10**6)) / (10**6) More on reddit.com
🌐 r/learnpython
18
9
April 15, 2023
🌐
EyeHunts
tutorial.eyehunts.com › home › python float 2 digits after dot
Python float 2 digits after dot - Tutorial - By EyeHunts
February 17, 2023 - Use the round() function to float 2 digits after the dot in Python. Use a certain precision of string formatting when producing output due...
🌐
TutorialsPoint
tutorialspoint.com › how-to-round-down-to-2-decimals-a-float-using-python
How to round down to 2 decimals a float using Python?
August 29, 2023 - Convert the given floating-point number using the Decimal() function of the decimal module. Round the number upto 2 digits (here 2 decimal palace . hence we give 2 zeros after the decimal point) after the decimal point using the value.quantize(decimal.Decimal()) function.
🌐
Analytics Vidhya
analyticsvidhya.com › home › 6 ways to round floating value to two decimals in python
6 Ways to Round Floating Value to Two Decimals in Python
November 4, 2024 - The built-in Python function round() can round a floating-point number to an integer or to a specified number of decimal places. You can specify the number of decimal places you want and the number you want to round using two different ...
🌐
PythonHow
pythonhow.com › how › limit-floats-to-two-decimal-points
Here is how to limit floats to two decimal points in Python
Here is an example of how to use format to limit a float to two decimal points: x = 3.14159265 # Format x as a string with two decimal points y = "{:.2f}".format(x) print(y) # Output: "3.14"The format function takes a format string as the first argument and the value to format as the second argument.
Find elsewhere
🌐
AskPython
askpython.com › home › how to format a number to 2 decimal places in python?
How to Format a Number to 2 Decimal Places in Python? - AskPython
February 27, 2023 - Like before when we only used %f for the full float value to be showcased, but here we are adding “%.1f” for the 1 digit to appear after the decimal and “%.2f” for the 2 digits to appear after the decimal.
🌐
Python Guides
pythonguides.com › python-print-2-decimal-places
How to Print Two Decimal Places in Python
December 22, 2025 - Master the art of formatting Python floats. Learn 5 easy methods to print 2 decimal places in Python using f-strings, format(), and the round() function.
🌐
YouTube
youtube.com › watch
python float 2 digits after dot - YouTube
Download this code from https://codegive.com Title: Formatting Python Floats to Display Two Digits After the Decimal PointIntroduction:In Python, working wit...
Published   February 2, 2024
🌐
GitHub
gist.github.com › jackiekazil › 6201722
How do I round to 2 decimals in python? · GitHub
Ref: https://stackoverflow.com/questions/3410976/how-to-round-a-number-to-significant-figures-in-python ... how to get 3.25, 3.27, 3.29 to be considered as 3.25 and 3.20, 3.22, 3.24 to be considered as 3.20 ? any advice. ... In [12]: timeit.timeit("round(7.325, 2)") Out[12]: 0.39438656000129413 In [9]: timeit.timeit("from decimal import Decimal, ROUND_DOWN;round(Decimal('7.325'), 2)") Out[9]: 0.9643819720076863 In [21]: timeit.timeit("float('%.2f' % 7.325)") Out[21]: 0.3827699579996988
🌐
w3resource
w3resource.com › python-exercises › string › python-data-type-string-exercise-30.php
Python: Print the following floating numbers upto 2 decimal places - w3resource
June 12, 2025 - Write a Python program to print the following numbers up to 2 decimal places. ... # Define a variable 'x' and assign it the value 3.1415926 (a floating-point number). x = 3.1415926 # Define a variable 'y' and assign it the value 12.9999 (a floating-point number).
🌐
Sololearn
sololearn.com › en › Discuss › 3288381 › how-to-round-to-2-decimal-places-in-python
How to round to 2 decimal places in python | Sololearn: Learn to code for FREE!
Yes, you can use the round() function in Python to round a float to a specific number of decimal places. In your case, you can use round(number, 2) to round the number to 2 decimal places.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-round-floating-value-to-two-decimals-in-python
How to Round Floating Value to Two Decimals in Python - GeeksforGeeks
July 23, 2025 - In Python, we can use the decimal module to round floating-point numbers to a specific number of decimal places with higher precision and control compared to the built-in floating-point arithmetic.
🌐
w3tutorials
w3tutorials.net › blog › round-float-to-2-digits-after-dot-in-python
How to Round a Float to 2 Decimal Places in Python: A Pythonic, Less Verbose Method (Avoiding round() Pitfalls) — w3tutorials.net
Rounding floating-point numbers to a specific number of decimal places is a common task in Python, especially in fields like finance, data analysis, and user interface design. Whether you’re displaying currency values (e.g., `$19.99` instead of `$19.999999`) or formatting numerical output ...
🌐
Quora
quora.com › How-do-you-print-a-number-with-two-digits-after-the-decimal-point
How to print a number with two digits after the decimal point - Quora
E.g. decimal 0.1 can lead to surprises in binary floating point. If your input will be only integers, Python 3 will still give a float as the result of the single slash divide operator. Printing the average to 2 decimal places is a simple matter of formatting.
🌐
Javatpoint
javatpoint.com › how-to-get-2-decimal-places-in-python
How to Get 2 Decimal Places in Python - Javatpoint
How to Get 2 Decimal Places in Python with tutorial, tkinter, button, overview, canvas, frame, environment set-up, first python program, etc.
🌐
Studytonight
studytonight.com › python-howtos › how-to-round-floating-value-to-two-decimals-in-python
How to Round Floating Value to Two Decimals in Python - Studytonight
January 21, 2021 - We can use str.format() function to display float value with two decimal places. It keeps the actual value intact and is simple to implement. ... Sir, your shopping bill amount is Rs.