Discuss / Python / O(∩_∩)O

O(∩_∩)O

Topic source

Pop_林肥強

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):
    # 字符串翻转
    def string_reverse(string):
        return string[::-1]

    str_n = str(n)
    return str_n == string_reverse(str_n)

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

  • 1

Reply