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

Why is my prime number code not working?

OpenStudy (anonymous):

prime = [2] while len(prime) <= 1000: i=3 a = 0 for number in prime: testlist= [] testlist.append(i%number) if 0 in testlist: i=i+1 else: prime.append(i) i=i+1 print(prime[999]) This is my code, but for some odd reason it's not printing me a value back. I cannot find an infinite loop either.

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!