LeetCode_Palindrome Number
2019-12-26 本文已影响0人
钱晓缺
https://www.jianshu.com/p/7fe7c0dfd216
import operator
#import copy
class Solution:
def isPalindrome(self, x: int) -> bool:
string=str(x)
l=list(string)
#new_l=copy.deepcopy(l)
new_l=l[:]
l.reverse()
if operator.eq(new_l,l):
return True
else:
return False