#生成序列 def _odd_(): n=1 while True: n=n+1 yield n #定义筛选函数 def _shaixuan(n): return str(n)==str(n)[::-1] def _shai(): yield 1 it=_odd_() while True: n=next(it) yield n it=filter(_shaixuan,it) for n in _shai(): if n<1000: print(n) else: break
Sign in to make a reply
Gussun