打印质数
prime_list=[2] def is_prime(num): i=0 n=prime_list[i] while num//n>=n: if num%n==0: return False i+=1 n = prime_list[i] return True def get_prime(num): for i in range(3,num+1): if is_prime(i): prime_list.append(i) get_prime(1000) for i in prime_list: print(i)