Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

How to round off a floating number using Python?

How to round off a floating number using Python?                        


1 Answer
Jayashree

The round() function in Python's library rounds the number to given position. Following are some examples.

>>> round(11.6912,2) # upto second decimal place
11.69
>>> round(11.6912,1) # upto first place after decimal point
11.7
>>> round(11.6912) # rounded to nearest integer
12
>>> round(11.6912,-1)#rounded to ten's place
10.0
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.