Palindrome Number
Python
1class Solution:
2 def isPalindrome(self, x):
3 """
4 :type x: int
5 :rtype: bool
6 """
7 if len(str(x)) == 1:
8 return True
9 num = x
10 if num < 0:
11 return False
12 reverse = ""
13 while num != 0:
14 reverse += str((num % 10))
15 num //= 10
16 if x == int(reverse):
17 return True
18 else:
19 return False