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

I wanted to code a variation of the 1000th prime number problem in the first problem set. I wanted to make it so that the user can choose which prime number they want. I used the following code but the program never stops. candidate = 5 count = 3 total = raw_input("Which prime number would you like to find?") while count <= total: for divisor in range(2, candidate // 2 + 1): remainder = candidate % divisor if remainder == 0: break else: count += 1 print(candidate) candidate += 1 print(candidate - 1), "is the number %d

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!