Saturday, March 3, 2018

Number round() Method


Number round() Method in Python 3:

Description
round() is a built-in function in Python. It returns x rounded to n digits from the decimal point.

Syntax
Following is the syntax for the round() method
round(x [, n] )

Parameters
· x - This is a numeric expression.
· n - Represents number of digits from decimal point up to which x is to be rounded. Default is 0.
Return Value
This method returns x rounded to n digits from the decimal point.

Example
The following example shows the usage of round() method.




When we run the above program, it produces the following result-