Discuss / Python / 利用list的reverse方法判断回文

利用list的reverse方法判断回文

Topic source

畋恬天

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

def is_palindrome(n): a=[] def num2list(u): L=[] while u: L.append(u%10) u=u//10 return L a=list(reversed(num2list(n))) return a==num2list(n):

畋恬天

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

最后多打了一个冒号


  • 1

Reply