在python中检查回文数时,运算符//的含义是什么

在python中检查回文数时,运算符//的含义是什么,python,palindrome,Python,Palindrome,所以我得到了这个代码来检查一个数字是否是回文,它工作得很好,但是我得到了一个关于while循环中一些操作符的用法的问题。在原始变量和整数10之间使用的运算符/。它对原始的p值做了什么,是除法还是?这是我使用的代码 def test_palindrome(p): o=p#store the original value of p in some variable reversed_number=0#declare reversed_number and init to zero

所以我得到了这个代码来检查一个数字是否是回文,它工作得很好,但是我得到了一个关于
while
循环中一些操作符的用法的问题。在原始变量和整数
10
之间使用的运算符
/
。它对原始的
p
值做了什么,是除法还是?这是我使用的代码

def test_palindrome(p):
    o=p#store the original value of p in some variable
    reversed_number=0#declare reversed_number and init to zero
    while(p>0):
        rem=p%10#Get the remainder of argument and ten
        reversed_number=reversed_number*10+rem
        p=p//10#This is the operator whose function is in question, am not sure if its dividing
    if(reversed_number==o):#do comparison with original input and return 
        print(f"{o} is a palindrome")
    else:
        print(f"{o} is not a palindrome")
test_palindrome(number)

/
表示楼层划分。楼层分割将始终为您提供结果的整数楼层

程序首先从检查
p>0
开始。假设
p=1001

1001//10=100
1001/10=100.1

如果您使用
p/10
而不是
p//10
p
永远不会小于
0
。十进制:
0.1
(示例)将始终存在。因此,条件
p>0
始终为真,会破坏程序



如评论中所述,post可能有用。

/
表示楼层划分。楼层分割将始终为您提供结果的整数楼层

程序首先从检查
p>0
开始。假设
p=1001

1001//10=100
1001/10=100.1

如果您使用
p/10
而不是
p//10
p
永远不会小于
0
。十进制:
0.1
(示例)将始终存在。因此,条件
p>0
始终为真,会破坏程序



正如评论中提到的,帖子可能有用。

5/2=2.5
但是
5//2=2
是的,谢谢,在线获取代码是一场噩梦,但是谢谢
5/2=2.5
但是
5//2=2
是的,谢谢,在线获取代码是一场噩梦,但感谢Hanks的解释,我只是想知道运营商在做什么means@CoderTimothy没问题,我想在你的程序中也包括它的意思会很有用。谢谢你的解释。我只是想知道操作员是什么意思means@CoderTimothy没问题,我认为在你的程序中也包含它的含义是有用的。