I saw the tutorial on Youtube on how to solve Project Euler`s problem 7 and have found this piece of code:
numbers_prime_to_find = 10001
x = 2
list_of_primes = []
while (len(list_of_primes) < numbers_prime_to_find):
if all(x % prime!=0 for prime in list_of_primes): # for prime in list_of_primes:
list_of_primes.append(x) # if x%prime
x+=1
print(list_of_primes[-1])
main()
It seems pretty obvious to me except this one line:
if all(x % prime!=0 for prime in list_of_primes)
Can someone try to explain this to me as I am struggling badly to find information about this method? Thanks in advance ^-^