Python round() function
Published February 16, 2022The 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
Article Contributed By :
|
|
|
|
322 Views |