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?
You may use looping constructs to find the 1000th prime
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
I generated all odd numbers through 8000, then tested weather they were prime keeping count until 1000.
sorry for the late response everyone who post but here is the code Thank all of you for the help and time
Join our real-time social learning platform and learn together with your friends!