rounding

Turning a number with a fractional part into a whole number by a chosen rule, such as nearest, towards zero or half to even.

In more detail

Python's int() truncates towards zero, which quietly drops fractions of a penny, while round() goes to the nearest whole number. When a value sits exactly halfway, round() picks the even neighbour, so round(2.5) is 2. For money that is a policy decision, and tests with awkward cases are how you pin it down.

Related terms

Taught in

References