Discuss / Python / #练习

#练习

Topic source
def is_palindrome(n):
    lt1 = str(n)[-1::-1]
    lt2 = str(n)[::1]
    b=True
    for i in range(len(lt1)):
        if lt1[i] !=lt2[i]:
            b = False
            break
    return b
print(list(filter(is_palindrome,range(1,1000))))

  • 1

Reply