Python round() function

Published February 16, 2022

The round function in Python is used to round a given number to the specified decimal point. This function returns a floating-point value that has been rounded to the specified precision. This method, by default, rounds a number to zero decimal points.

Let's have a peek at the syntax of round()

 

Syntax
 

round(number to be rounded, number of digits up to where  the number will be rounded)

Example

print(round(4.674, 2))


Output

After rounding our number up to 2 digits, the following will be displayed

 

 

Download Source code

 

Article Contributed By :
https://www.rrtutors.com/site_assets/profile/assets/img/avataaars.svg

322 Views