def is_palindrome(n):
list = [] temp = n while temp > 0: list.append(temp % 10) temp = temp // 10 l = len(list) // 2 c = 0 while c < l: if list[c] == list[-(c+1)]: c = c + 1 else: break return c >= l
output = filter(is_palindrome, range(1, 1000)) print(list(output))
Sign in to make a reply
查无此人ChenCv_v
def is_palindrome(n):
output = filter(is_palindrome, range(1, 1000)) print(list(output))