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.
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.
The syntax of round function in Python is:-
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.
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.
x = 12.233443 print(round(x, 2)) print(round(x, 3)) print(round(x, 4)) print(round(x, 5))
12.23 12.233 12.2334 12.23344
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