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实现(暴力解法)
最新推荐文章于 2024-05-16 19:31:18 发布