Discuss / Python / 自认为这种方法简单易懂且不限范围

自认为这种方法简单易懂且不限范围

Topic source

第一次发作业,请大家指教啦。

def is_palindrome(n):
    x = n
    x = str(x)
    x = x[::-1]
    x = int(x)
    return n == x
output = filter(is_palindrome, range(1, 1000000))
print(list(output))

  • 1

Reply