+ 4

Why does 3.5 on round off gets to 4 but 4.5 doesn't round to 5 ?

1st May 2019, 8:16 PM
Aditya Anupam
Aditya Anupam - avatar
3 odpowiedzi
+ 7
Python rounds up/down to the nearest even integer. round(3.5, 0) = 4.0 round(4.5, 0) = 4.0
1st May 2019, 9:07 PM
Anna
Anna - avatar
+ 3
Try to round 3.51 and 4.51 😎 In mathematic, float number are round to upper if reminder equal to 5, but in Python, float number are rounded to nearest integer 😎 In other word, if you enter 3.5, float number are round to 4 and second example: 4.5 are round to 4. P.S. Try to catch reminder...
1st May 2019, 9:15 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 1
*confused screaming*
14th May 2019, 8:30 AM
Glo Op
Glo Op - avatar