Hello Python programmer, In this article, you will learn all about Python round() built-in function that is used to returns the rounded version of a specified number, with the specified number of decimals.
In the previous tutorial, we have seen lots of Python built-in functions along with examples.
Table of Contents
Python round() function
Python round() function is a Python built-in function that is used to return the rounder version of a number with a specified number of decimals.
Syntax
The syntax of round function in Python is:-
round(number, digits)
Parameters
round function in Python take two arguments.
- number:- Number to be rounded.
- digits:- Optional, The number to decimals to use when a specified number is rounded.
Return value
The returns value of round function in Python is rounded version of the specified number.
Python rounded function examples
Here we see python round function along using example.
Example:
x = 12.233443
print(round(x, 2))
print(round(x, 3))
print(round(x, 4))
print(round(x, 5))
Output
12.23
12.233
12.2334
12.23344
Conclusion
In this guide, you have learned all about Python round function to return the rounded version of the specified number with specified number of decimals.
If this article helped you please share and keep visiting for further python built-in functions tutorials.
Python built-in functions
For more information:- Click Here