"//" in python is an arithmetic operator, indicating integer division, which can return the integer part of the quotient (rounded down). The specific usage is as follows: [a = 10 b = 5 c = a//b], and the result is an integer 2.
In python, "//" is an arithmetic operator, indicating integer division, which can return the integer part of the quotient (rounded down).
(Recommended learning: python tutorial)
Code example:
#!/usr/bin/python # -*- coding: UTF-8 -*- a = 10 b = 5 c = a//b print "7 - c 的值为:", c
Output result:
7 - c 的值为: 2
Note: Python2.x Here, dividing an integer by an integer can only produce an integer. If you want to get the decimal part, just change one of the numbers to a floating point number.
The above is the detailed content of What does '//' mean in python. For more information, please follow other related articles on the PHP Chinese website!