round() function in python is used to round a floating number to the specified number of decimal places.

The general syntax for the round() function is

round() Parameters

Python round() function parameters
numberRequiredNumber to round
ndigitsOptionalNumber of decimal digits to round to.
Default is None.

If ndigits is not provided then the number is rounded to the nearest integer.

Let’s see some examples.

Example: Round numbers in Python using round()

Round To Ten’s or Hundred’s

We can also specify a negative value for ndigits. In this case, the number gets rounded to ten’s or hundreds.

Let’s see some examples of the same.

Rounding Up or Down

If you want to round number explicitly up or down then use ceil() or floor() function of python’s math module.



If Hope now rounding number in python would be easy for you. If you have any suggestions or doubts then comment below.

Leave a Reply

5 × 4 =