round()
function is used to find the the floating point number rounded off to the given ndigits digits after the decimal point. If no ndigits is provided, it rounds off the number to the nearest integer in Python for the given input.
round()
function is a part of Python Built-in Functions.
Syntax of round()
Function
The syntax of
round()
function in Python is:
round(number[, ndigits])
Parameters of round()
Function in Python
x
– Where x
is any valid . This parameter is required.
Compatibility
round()
function is available and compatible with both Python 2.x
and 3.x
.
Return Value of round()
Function in Python
round()
function returns the floating point number rounded off to the given ndigits digits after the decimal point. If no ndigits is provided, it rounds off the number to the nearest integer for the given input.
Python round()
Function Example 1
Example CODE
Output:
Python round()
Function Example 2
Example CODE
Output: