classSolution:defisPalindrome(self, x:int)->bool:
list_num =[]
i =-1if x <0:returnFalseelse:while(x %10!= x):
a = x %10
x = x //10
list_num.append(a)
i +=1
list_num.append(x)
i +=1
length = i+1for i inrange(length //2):if list_num[i]!= list_num[length - i-1]:returnFalsereturnTrue
Other:
classSolution:defisPalindrome(self, x:int)->bool:if x <0:returnFalse
y =0
x_hut = x
while(x_hut !=0):
mid = x_hut %10
y = y *10+ mid
x_hut //=10return x == y