round to 1 dp python code example Example 1: how to round a float in python round(number, ndigits) Example 2: round off float to 2 decimal places in python answer = str(round(answer, 2))