Python round() function
Understand the Python round() function to round numbers to a specific decimal point and return a floating-point value at rrtutors.com Check it out!
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