def is_palindrome(): return lambda x:int(str(x))==int(str(x)[::-1]) def primes(): it=from11AllNum() it=filter(is_palindrome(),range(11,1000)) while True: n=next(it) yield n
疑问???? it=filter(is_palindrome(),range(11,1000))没必要放在循环里吧
你这个有问题吧,如果你要弄成生成器,那么用it去替代range(11,1000)
Sign in to make a reply
Young先森森
def is_palindrome(): return lambda x:int(str(x))==int(str(x)[::-1]) def primes(): it=from11AllNum() it=filter(is_palindrome(),range(11,1000)) while True: n=next(it) yield n
疑问???? it=filter(is_palindrome(),range(11,1000))没必要放在循环里吧