IT Blog

Round in python

There is a round(number, ndigits) function for rounding of numbers, where number is required number for rounding, ndigits is a number of simbols after comma. For example:

round(2.137, 2)  # = 2.14

Round function has some feature that consists in the fact that it works on the principle of bank rounding to round off the numbers in which the last five is a sign, for example:

round(2.05, 1)  # = 2.0
round(2.15, 1)  # = 2.1
round(2.25, 1)  # = 2.3
round(2.35, 1)  # = 2.4
round(2.45, 1)  # = 2.5
round(2.55, 1)  # = 2.5
round(2.65, 1)  # =...
Go

There is no search on this site, so I offer to use usual search engine, for example, Google, adding "vivazzi" after your request.

Try it

Select currency for displaying monetary values