def isPalindrome(self, x: int) -> bool:
temp = []
data: int
if x < 0:
return False
elif (x < 10 and x >= 0):
return True
else:
while x >= 10:
data = x % 10
temp.append(data)
x = x // 10
temp.append(x)
for i in range(0, len(temp) // 2):
if temp[i] != temp[-1 - i]:
return False
return True
x = int(eval(input()))
print(isPalindrome(0, x))
回文Python实现(暴力解法)
最新推荐文章于 2025-02-03 22:41:48 发布
5131

被折叠的 条评论
为什么被折叠?



