Discuss / Python / 我的笨方法

我的笨方法

Topic source

Nemo尼谟

#1 Created at ... [Delete] [Delete and Lock User]
def is_palindrome(n):    
    f=str(n)
    x=0
    a=True
    while(x<len(f)):
        if (f[x]!=f[-x-1]):
            a=False
        x=x+1
    return a


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

  • 1

Reply