• anonymous
My first attempt at prob set 1... When I call the Find1000Prime function I get the right answer but there is a slight delay as if my code is very inefficient. Will anyone provide me with suggestions to improve this code? def isPrime(num): i = 2 if num == 1: return 0 if num == 2: return 1 while i <= num-1: if num%i == 0: return 0 else: i = i + 1 return 1 def Find1000Prime(): i = 2 j = 0 while j < 1000: if isPrime(i) == 1: j = j + 1 if j == 1000: return i i = i + 1
MIT 6.00 Intro Computer Science (OCW)
• 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.

Looking for something else?

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