windows - python code is restarting -


as i'm proceeding project euler started learning python. although great , simple language got bit stuck.

every code wrote , tried run automatically restarting. think because of very long loop (for example, finding 10001 prime number), cant find out how fix issue. can me, give me guide line or tip?

oh, if matters im using python 2.7

thank you!

the code example:

count = 0 num = 0 = 1 def prime(num):     if num <= 1:         return false     if num == 2:         return true     else:         in range(3, num):             if (num % i) == 0:                 return false                 break         else:             return true  while (count < 10001):     if prime(i) == true:         num ==         count == count + 1     = + 1  print num     

you need change == = (twice) in while loop:

while (count < 10001):     if prime(i) == true:         num =         count = count + 1     = + 1 

then code runs fine, , prints num 104729


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -