The round
function rounds a number to the given precision in decimal digits:
value = 34.185609
print(round(value, 2))
# 34.19
print(round(value, 3))
# 34.186
But it can also be used to round to the nearest, 10, 100, 1000, and so on, by using negative arguments:
value = 123456
print(round(value, -1))
# 123460
print(round(value, -2))
# 123500
print(round(value, -3))
# 123000
print(round(value, -4))
# 120000
This can be useful when you don't care about the exact value while analyzing large numbers, e.g., when looking at the population of a city.
You can learn more about precision handling in Python in this article.