Is there a benefit to using one over the other? In Python 2, they both seem to return the same results:
>>> 6/3
2
>>> 6//3
2
The above answers are good. I want to add another point. Up to some values both of them result in the same quotient. After that floor division operator (//
) works fine but not division (/
) operator.
- > int(755349677599789174/2)
- > 377674838799894592 #wrong answer
- > 755349677599789174 //2
- > 377674838799894587 #correct answer