def is_palindrome(n):
L = str(n) x = len(L) // 2 if len(L) % 2 == 1 and L[:x] == L[-1:x:-1]: return n if len(L) % 2 == 0 and L[:x] == L[-1:x-1:-1]: return n
output = filter(is_palindrome, range(1, 1000)) print(list(output))
Sign in to make a reply
JOIEUH
-- coding: utf-8 --
def is_palindrome(n):
output = filter(is_palindrome, range(1, 1000)) print(list(output))