First look at the use of single oblique bar: To give a few examples
>>> print (5/3), type (5/3)
1.6666666666666667
(None, <class ' float ' >)
>>> print (6/3), type (6/3)
2.0
(None, <class ' float ' >)
>>> print 5.0/3,type (5.0/3)
1.66666666667 <type ' float ' >
>>> print 5/3.0,type (5/3.0)
1.66666666667 <type ' float ' >
>>> print 5.0/3.0,type (5.0/3.0)
1.66666666667 <type ' float ' >
As can be seen, whether the value is divisible, or A/b is not an int type, single slash action is all float type, the result is to retain a number of decimal places, is our normal thinking of the division operation
Look at the example of the double oblique lever:
>>> print 5//3,type (5//3)
1 <type ' int ' >
>>> print 5.0//3,type (5.0//3)
1.0 <type ' float ' >
>>> print 5//3.0,type (5//3.0)
1.0 <type ' float ' >
>>> print 5.0//3.0,type (5.0//3.0)
1.0 <type ' float ' >
>>>
As can be seen, the return type of a//b depends on the data type of a and B, only the result is int when both A and B are int (this means that two number is being removed)
is the smallest integer of the result, and/get is the actual division result, which is the main difference between the two
The difference between the python--"/" operator and the "//" operator