I used / initially in the def, and it gave the answer 50.0 for this one -print(win_percentage(5, 5))- but when i changed that to //, it showed 0. Anyone know why?

@adityagandhi98, in Python3, the **/** operator performs conventional floating-point division, and returns a float.

The **//** operator performs “floor division”, (see note below) and returns an int if both operands are int, and a float otherwise.

```
print(5/3, -5/3) # conventional division
print(5//3, -5//3, 5//(-3)) # "integer division"
print(5.0//3, -5//3.0) # # "integer division" with floats
'''Output:
1.6666666666666667 -1.6666666666666667
1 -2 -2
1.0 -2.0
'''
```

Note: In Python, floor division returns the integer part of the quotient that is towards zero if positive and away from zero if negative => i.e., “towards negative infinity” in either case.

2 Likes