Palindrome Number
Screen Shot 2019-01-04 at 10.48.41 PM.png答案:
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
orig = x
rev = 0
if x >= 0:
while x > 0:
dig = x % 10
rev = rev * 10 + dig
x = x // 10
if rev == orig:
return True
else:
return False
else:
return False
网友评论