I would like to add an if after the getal in the for loop.
if all(number % getal != 0 for getal in primes):
primes.append(number)
I tried this, that did not work. Is if possible to add an if to the getal in the for loop?
if all(number % getal != 0 for getal if getal <= sqr_number in primes):
primes.append(number)
Aucun commentaire:
Enregistrer un commentaire