Takes a number and an integer as parameters, and returns the number with decimal places equal to the integer.


  • number is the number to be rounded. (Required)
  • digits is the number of decimals when rounding the number. Default is 0.

Example 1

The default number of decimal places used is 0.


Example 2

round() can be used with any number of decimal places. Numbers >= 5 will round up.


Example 3

round() can be useful when comparing numbers, for example, when comparing fractions and decimals.

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn Python on Codecademy