Try type(1/2.0) , this will return a float. One of the numbers must be a float to get the return value in a float.
The Python-2.x split operator follows the classic division. When representing integer operands, classical division truncates the decimal place, returning an integer (also known as gender division). If a pair of floating point operands is specified, it returns the actual floating point quotient (otherwise, this is a true division).
Example:
>>> 1 / 2
In Python 3.x, division works differently. type(1/2) will return a float type. The Python-3.x separation operator follows True Division.
source share