89DEVs

# Python round() function

```overview of round()
The round() function is used to round a float value to the specified number of decimals. By default, the round() function rounds to the integer, without any decimals.

use of round()
The round() function is used to round integers and float values to the specified number of decimal places.

```
# use of round() function
print(round(5, 1))
print(round(5.5))
print(round(5.15, 1))
```

In the first example, the number of decimals is specified as one. However, since an integer value is passed as an argument the same value without decimals is returned.
In the second example, the float value 5.5 is rounded to the integer value 6.
And in the last example, the float value 5.15 is rounded to one decimal.

5
6
5.2

syntax of round()
The syntax of the round() function is:

`round(number, decimals)`

arguments of round()
The round() function accepts between one and two arguments. The first argument is required and the second argument is optional.

argument
required
description

number
required
the number to be rounded

decimals
optional
the number of decimals to be rounded to

return value of round()
The round() function returns the rounded number rounded to the specified number of decimals. And if the number of decimals is not specified the return value is rounded to the nearest integer.```