import math
for i in range (50100room1):
for t in range(2,int(math.sqrt(i))+1):
if i % t == 0:
break
else:
print(i)
if I write like this, what I print out is 51, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53.
import math
for i in range (50100room1):
for t in range(2,int(math.sqrt(i))+1):
if i % t == 0:
break
else:
print(i)
when I took out the else, the result was correct. But I don"t think it"s logical, huh? Shouldn"t it be printed in the for loop? If you take it out, is it still in the for loop?