a = 6
b = 2
c = 9
print(c/b//b)
Could anyone tell why is the result of this 2.0 instead of 2? 9/2 = 4.5 4.5//2 should be 2 bcos floor division rounds it to the nearest integer value. But why is the result 2.0?
The floor division gives round off value. But it necessarily not give an integer. So it depends on the type of operands and as 4.5 is a float value, hence the answer must be a float. And that's why 4//2 = 2 and 4.5//2 = 2.0