0
What is the different
I have 2 codes: def is_prime(num): for k in range(2,num): if num % k ==0: return False return True def prime_number(x): for i in range(3,x): if is_prime(i): yield i print(list(prime_number(1000000))) and def is_prime(num): for k in range(2,num): if num % k ==0: return False return True def prime_number(x): for i in range(3,x): if is_prime(i): yield i for i in prime_number(1000000): print(i) why only 2nd one print prime numbers but 1st dont? Can anyone help me explain. Thanks you a lot
4 Answers
+ 2
S.T Hentaro same problem as in this post:
https://www.sololearn.com/discuss/2141955/?ref=app
+ 3
I don't understand, what is your question exactly ?
0
I just fixed the question. So the main part here is why the 1st printed None. Sorry for my bad English
0
thanks you. Now i understand