python二分法查找程序
When we divide a number by another number – division operator (/) return quotient it may be an integer or float. But, when we need quotient without floating number – we can floor division (//) operator, it returns quotient (result) without floating points.
当我们用一个数字除以另一个数字时, 除法运算符 ( / )返回商,它可以是整数或浮点数。 但是,当我们需要无浮点数的商时,我们可以进行除法 ( // )运算符,它将返回无浮点数的商(结果)。
Example:
例:
Input:
a = 10
b = 3
# finding division
result1 = a/b;
print(result1)
# finding floor division
result2 = a//b
print(result2)
Output:
3.3333333333333335
3
Python code to find floor division
用Python代码查找楼层划分
# python program to find floor division
a = 10
b = 3
# finding division
result1 = a/b
print("a/b = ", result1)
# finding floor division
result2 = a//b
print("a/b = ", result2)
Output
输出量
a/b = 3.3333333333333335
a/b = 3
翻译自: https://www.includehelp.com/python/find-floor-division.aspx
python二分法查找程序