Discuss / Python / 整数变字符串,字符串反转比较

整数变字符串,字符串反转比较

Topic source

ywjco_567

#1 Created at ... [Delete] [Delete and Lock User]
is_palindrome = lambda n: str(n)==''.join(list(reversed(str(n))))

ywjco_567

#2 Created at ... [Delete] [Delete and Lock User]

简化,不用list转换。

is_palindrome = lambda n: str(n)==''.join(reversed(str(n)))

  • 1

Reply