count = 1
i = 3
while count != 1000:
for k in range(2,i):
if i%k == 0:
break
else:
print(i)
count += 1
i += 2
In this piece of python code, if "break" is executed the program will jump over to adding i+=2, is it not supposed to execute "else" first?, given that "else" is not indented to the same level of "if" and thus does not make part of the "for" loop.
Aucun commentaire:
Enregistrer un commentaire