4 ms·
Python (prior to 3.0): 1/3 == 0 well, unless you do from __future__ import division
by riobard 18y ago
Python (prior to 3.0): 1/3 == 0
well, unless you do
from __future__ import division
- Dilpil 18y agoIf your working with integers, 1 div 3 is indeed zero.
- Zaak 18y agoThat makes sense in a language like C, but in Python there's no telling if you've got integers or floats at the point the division happens. I'm very happy it's fixed in Python 3.
- Raphael 18y agoWait, then how do you do integer division in Python 3?
- rwiser 18y ago1 // 3 == 0