def is_prime(x):
if x<2:
return False
elif x%2==0:
if x==2:
return True
else:
return False
else:
for i in range(3,x+1,2):
if x%i==0 and i==x:
return True
break
elif x%i==0:
return False
break
def sum_primes(m):
total=0
for i in range (3,m,2):
if is_prime(i):
total+=i
return total+2
print sum_primes(2000000)
I'm trying to solve one the Project-Euler problems, and this program works but it takes too much time to give me the answer. How can I make it faster guys ?