class Solution: def isPalindrome(self, x: int) -> bool: if x < 0: return False else: x_copy = x pal_num = 0 while x: pal_num = pal_num *10 + x % 10 x = x // 10 if pal_num == x_copy: return True else: return False