# Python round()

#### The round() function returns a floating-point number rounded to the specified number of decimals.

The syntax of `round()` is:

`round(number, ndigits)`

## round() Parameters

The `round()` function takes two parameters:

• number - the number to be rounded
• ndigits (optional) - number up to which the given number is rounded; defaults to 0

## Return value from round()

• If `ndigits` not provided, `round() `returns the nearest integer to the given number.
• If `ndigits` given, `round()` returns the number rounded off to the `ndigits` digits.

## Example 1: How round() works in Python?

``````# for integers
print(round(10))

# for floating point
print(round(10.7))

# even choice
print(round(5.5))``````

Output

```10
11
6
```

## Example 2: Round a number to the given number of decimal places

``````print(round(2.665, 2))
print(round(2.675, 2))``````

Output

```2.67
2.67
```

In the program, you may think 2.675 should have been rounded to 2.68. This isn't a bug. This is considered the standard rounding method these days.