Discuss / Python / 傻了,没想到切片

傻了,没想到切片

Topic source

水蔓姐姐

#1 Created at ... [Delete] [Delete and Lock User]
# -*- coding: utf-8 -*-

def is_palindrome(n):
    L2 = list(str(n))
    L2.reverse()
    return list(str(n)) == L2 #n为逐个元素

output = filter(is_palindrome, range(1, 1000))
print(list(output))

  • 1

Reply