Definition
The round() function returns a floating-point number that is a rounded version of the specified number, with the specified number of decimals. The default number of decimals is 0, returning the nearest integer.
Syntax
round(n, digits)
Parameters
Parameter | Description |
---|---|
n | Required. The number to be rounded |
digits | Optional. The number of decimals to use when rounding the number. Default is 0 |
Examples
x = round(12.345678)
print(x)
y= round(12.3456789, 1)
print(y)