Python 3. Python 3 round():
... , (, , (0,5), (-0,5) 0, (1.5) 2)
2.5 2 3, 2.
Python 2 docs round():
... , 0 (, , round (0.5) 1.0 round (-0.5) -1.0)
2.5 2 3, 3 ( ).
, , , Applesoft BASIC:
10 X = 5
15 PRINT "ROUND(" X "/2) = " (INT((X/2)+0.5))
20 X = 4.99
25 PRINT "ROUND(" X "/2) = " (INT((X/2)+0.5))
... :
>>> x = 5 / 2
>>> print(x)
2.5
>>> y = int(x + 0.5)
>>> print(y)
3
>>> x = 4.99 / 2
>>> print(x)
2.495
>>> y = int(x + 0.5)
>>> print(y)
2
>>>