Discuss / Python / #需要一个过滤非回数的函数

#需要一个过滤非回数的函数

Topic source

J_Q_Zhang

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

-- coding: utf-8 --

需要一个过滤非回数的函数

def is_palindorome(n): n=str(n) if n[0]!=n[-1]: return False else: return True output = filter(is_palindorome, range(1, 1000)) print(list(output))

傻哥1991

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

超过4位数就不行了。


  • 1

Reply