Skip to content

Round float to 2 decimal places Python | Example code

  • by

Use the round function to Round float to 2 decimal places in Python. This method takes as its first argument the number and the second argument is the precision after the decimal point.

round(number, digits) 

Example Round float to 2 decimal places Python

Simple example code rounds down to 2 and 3 decimals a float using Python.

print(round(1.4756, 2))

print(round(1.3339, 3))

Output:

Round float to 2 decimal places Python

Do comment if you have any doubts or suggestions on this Python float topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading