Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 16 Online
OpenStudy (anonymous):

I attempt problem 2 and got it to run by using the range function but finding the 1000th prime number is what i have troubles with. Do i have to add another branch to get the 1000th prime number part? Also for the range do is there a way to put infinity so the computer can keep going until it reached 1000th or is there no way?

OpenStudy (anonymous):

Post your code http://www.codepad.org

OpenStudy (anonymous):

You may use looping constructs to find the 1000th prime

OpenStudy (anonymous):

you could re-structure your code to use a while loop instead of a for loop. http://docs.python.org/tutorial/introduction.html#first-steps-towards-programming it helps to write down what you want to do first. something like: while number_of_primes_found < 1000 find another prime increment number_of_primes_found return or print the last prime that was found

OpenStudy (anonymous):

I generated all odd numbers through 8000, then tested weather they were prime keeping count until 1000.

OpenStudy (anonymous):

sorry for the late response everyone who post but here is the code Thank all of you for the help and time

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!