def is_palindrome(n): str1 = list(str(n)) str2 = [] i = 1 for x in str1: str2.append(str1[len(str1) - i]) i += 1
return str2 == str1
output = filter(is_palindrome, range(1, 1000)) print(list(output))
Sign in to make a reply
FJ-W97
def is_palindrome(n): str1 = list(str(n)) str2 = [] i = 1 for x in str1: str2.append(str1[len(str1) - i]) i += 1
output = filter(is_palindrome, range(1, 1000)) print(list(output))