anonymous
  • anonymous
need help with P1. here's what I've figured out so far but I don't know how to call for the 1000th number. help? def isprime(startnumber): startnumber*=1.0 for divisor in range(2,int(startnumber**0.5)+1): if startnumber/divisor==int(startnumber/divisor): return False return True for a in range(2,10000): if isprime(a): print a
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
rsmith6559
  • rsmith6559
numPrimes = 0 a = 3 while numPrimes <= 1000 if isprime( a ) numPrimes += 1 if numPrimes == 1000 print "We have 1000!" a += 2
anonymous
  • anonymous
I've just finished lecture 2 and looking at P1 and the tips, I think we need to isolate the odd numbers first and then figure out a method to test whether the odd number is a prime number. How do you test a number whether it is a prime?

Looking for something else?

Not the answer you are looking for? Search for more explanations.