round off to next value python code example
Example 1: how to round to the nearest 25 python
def myround(x, base=5):
return base * round(x/base)
Example 2: how to round a number in python
round(n, ndigits) # round(1.123456789,5) --> 1.12346
def myround(x, base=5):
return base * round(x/base)
round(n, ndigits) # round(1.123456789,5) --> 1.12346