rounding off decimal in python code example Example 1: how to round a float in python round(number, ndigits) Example 2: round to the nearest integer python int(round(x))