You have changed your original post but your claim was that in Python 3 floor division returns float and Python 2 floor division returns integer.
Let's do reality check with Python 3:
So if one of the operands is a float then indeed the floor division returns a float:
Quote:Better end this dream before it becomes a nightmare
--Rachel Cohn
Let's do reality check with Python 3:
>>> import sys >>> sys.version '3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23) \n[Clang 6.0 (clang-600.0.57)]' >>> 10 // 4 2With Python 2
>>> import sys >>> sys.version '2.7.16 (default, Oct 30 2020, 02:15:49) \n[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri' >>> 10 // 4 2EDIT: if interested one can read PEP 238 Changing the Division Operator > Semantics of Floor Division:
Quote:Specifically, if a and b are of the same type, a//b will be of that type too. If the inputs are of different types, they are first coerced to a common type using the same rules used for all other arithmetic operators.
So if one of the operands is a float then indeed the floor division returns a float:
>>> 10.0 // 4 2.0 >>> 10 // 4.0 2.0
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.