Why 4,5 round to 4 in python it is against math | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why 4,5 round to 4 in python it is against math

PYTHON round ()

9th Jun 2020, 5:16 AM
Eyosias Mulugeta
Eyosias Mulugeta - avatar
4 Answers
+ 1
THE ROUND () IS USED ONLY FOR NEAREST EVEN
9th Jun 2020, 5:45 AM
Eyosias Mulugeta
Eyosias Mulugeta - avatar
+ 2
Hello
9th Jun 2020, 5:17 AM
Eyosias Mulugeta
Eyosias Mulugeta - avatar
+ 1
4.5 is 4 bcoz nearest even value to 4.5 is 4 If you will try to round 5.5 it will be 6 coz 6 is nearest even number
9th Jun 2020, 5:36 AM
ABHISHEK
ABHISHEK - avatar
+ 1
Eyosias Mulugeta Round function can round any number not just even numbers but you are rounding .5 decimal which have some rules in maths when rounding https://code.sololearn.com/ccPlRd5ZSdyj/?ref=app
9th Jun 2020, 5:50 AM
ABHISHEK
ABHISHEK - avatar