def store(max): start = 10 while start < max: yield start start += 1 def fib(x): x = str(x) lens = len(x) start = 1 rs = True for v in range(1,lens // 2 + 1): if x[:start] != x[-start:]: rs = False return rs def palindrome(max = 1000): l = store(max) return filter(fib,l) for x in palindrome(): print(x)
Sign in to make a reply
我是怪物1981