//What does it mean in python?
In python // means taking integer division and returning the integer part of the quotient (rounded down)
#!/usr/bin/python# -*- coding: UTF-8 -*- a = 10 b = 5 c = a//b print "c 的值为:", c
Output:
c 的值为: 2
Note:
In Python2.x, dividing an integer by an integer can only result in an integer. If you want to get the decimal part, just change one of the numbers to a floating point number.
>>> 1/2 0 >>> 1.0/2 0.5 >>> 1/float(2) 0.5
Related recommendations: "Python Tutorial"
The above is the detailed content of //What does it mean in python?. For more information, please follow other related articles on the PHP Chinese website!