L = []
nmax = 30
for n in range(2, nmax):
for factor in L:
if n % factor == 0:
break
else: # no break
L.append(n)
print(L)
Does the else in the outer loop work if the if statement is not execute din the inner loop...are they really connected inspite being in different loops
Aucun commentaire:
Enregistrer un commentaire