def is_palindrome(n): if not isinstance(n, int): raise TypeError('参数不是数字') a = list(str(n)) return a == list(reversed(a)) # 或者 def is_palindrome(n): if not isinstance(n, int): raise TypeError('参数不是数字') s = str(n) return s == s[::-1]
Sign in to make a reply
最帅的仔