Python round() function

The round() function in Python returns a number rounded to ‘ndigits’ precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input.

Syntax

Parameter

Number: This parameter represents the number to be rounded.

Digits: It is the optional parameter that represents the number of decimals to use when rounding the number.

Return

This function returns a floating point number after rounding off the specified number, with the specified number of decimals.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This