why round off of 45.5 is 46 while for 10.5 it is 10?

146 Views Asked by At

I was trying to round off two numbers in python 3.10

round(45.5)

and I got the result as 46 but when I tried to round off 10.5 :

round(10.5)

I got the result as 10

why round off of 45.5 is 46 while for 10.5 it is 10 ?

I could not understand this.

Is it python that follows certain rules for truncation, or is it a Math that says to round the different numbers following certain rules?

If later is correct then what these rules are?