Web Analytics

Python round() Function

Math Function Rounding

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, meaning that the function will return the nearest integer.

Syntax

round(number, digits)

Parameters

Parameter Description
number Required. The number to be rounded
digits Optional. The number of decimals to use when rounding the number. Default 0

Return Value

A float.

Example

Using the round() function:

Output
Click Run to execute your code

Related Functions