Discuss / Python / 练习

练习

Topic source

def is_palindrome(n): str_1=str(n) c=0 for i in range(len(str_1)): if(str_1[i]==str_1[len(str_1)-i-1]): c=c+1 if c==len(str_1): return True output = filter(is_palindrome, range(1, 1000)) print(list(output))


  • 1

Reply