I'm using PyCharm community 2018. I'm trying to find the sum of prime numbers from 1 to two million and this is my code.
primes = [x for x in range (1,2000000) if all (x%y!=0 for y in range (2,x))]
total = 0
for x in primes:
total = total + x
print (total)
It's been 20 minutes and I've still got no output. Do you have any suggestions to make it run faster or is my method wrong?