def reverse(n):
a = n // 100
b = n % 100 // 10
c = n % 100 % 10
aR, bR, cR = c, b, a
# 将整数变成字符串相加
return str(aR) + str(bR) + str(cR)
def isPalindrome(n):
testB = str(n)
testA = reverse(n)
if testB == testA:
print(f"{n} is palindrome number")
else:
print(f"{n} is not palindrome number")
isPalindrome(456)
isPalindrome(656)
07-20
316
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交