Python 3
>>> round(1.5)
2
>>> round(2.5)
2
>>> round(3.5)
4
>>> round(4.5)
4
I don't understand this. How is 3.5 rounded 4 but 4.5 rounded is not 5? Is there any way to get the normal way of round where if number is 5 or greater in the tenths column (>0.5) it will round to the next whole number?
EDIT: In Python 2.7 the round function behaved properly.
Answer - Credit: Ignacio Vazquez-Abrams.
To retain Python 2 rounding:
import math
>>> def old_round(n):
return math.floor(n + 0.5)
>>> old_round(4.5)
5