# 1. What is the result of the execution of the following code:

closed Jul 5
```2.Why does round(5 / 2) return 2 instead of 3?  (BRAIN)
>>> round(7 / 2)
>>> round(3 / 2)
>>> round(5 / 2)```

answered May 12 by (450 points)
reshown May 13 by ANG YU NING Moe

Answer 2:The issue here is that Python’s round method implements banker’s rounding, where all half values will be rounded to the closest even number.

commented May 13 by (450 points)
THIS IS THE ANSWER IF YOU DON'T KNOW :)
answered May 16 by (140 points)
the answer is 2.5 so if its returning an integer, it will disregard everything after the decimal point
answered May 16 by (300 points)

the round() function rounds the quotients of 7/2 and 3/2 to the nearest integer, which is 3 and 1, respectively. However, the quotient of 5/2 is rounded to 2. This is because the quotient 2.5 is closer to 2 than it is to 3.

answered May 24 by (150 points)
commented May 30 by (450 points)
+1 vote
answered May 25 by (160 points)

the round() function performs rounding based on certain rules. In the case of half-values (e.g., 2.5), it rounds to the nearest even number. This behavior is known as "round half to even" or "rounding to nearest, ties to even."
answered May 26 by (140 points)
because when you divide integers the outputted value is the floor (rounded down answer)
answered May 26 by (140 points)
because integer / integer is always be a integer

like 5/2 is integer /integer then answer is integer it remove the number after the point and showing only who's number are before point
answered May 29 by (180 points)
The result of the execution of the following code is:

2
3
2

The round() function rounds a number to the nearest integer. In the first two cases, the result is the nearest integer to the quotient of the two numbers. In the third case, the quotient, 2.5, is halfway between 2 and 3. The round() function rounds halfway cases to the even number, so the result is 2.

The round() function uses a rounding algorithm called banker's rounding. Banker's rounding is a rounding algorithm that rounds halfway cases to the even number. This algorithm is often used in financial applications because it is considered to be more fair than other rounding algorithms.
answered Jun 23 by (140 points)

rounding option rounds to the next higer integer value if the number of digits for precision is zero. hence 5/2 is only 3.  not 2

4

2

3

answered Jun 28 by (140 points)
When we divide 5 with 2 we can get the answer which is in the decimal format that is 2.5.  So if the data type is int for the variable it prints 2 and removes decimal value 0.5.  Hence, the answer is 2 instead of 3
commented Jul 5 by (100 points)
moved Jul 5 by meenu parmar
3

1

2

it doesn't consider decimal value

as 7/2 gives 3 as quotient and 1 as a remainder.

so, output will be 3..

for 5/2 =2   and  3/2=1