Ray Holt wrote:
I have an assigment to find the 1000th. prime using python. What's wrong with the following code:PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate % x == 0: ## print PrimeCandidate, 'equals', x, '*', PrimeCandidate/xprint PrimeCandidate IsPrime = Falsebreak if IsPrime: PrimeCount = PrimeCount + 1 PrimeCandidate = PrimeCandidate + 2 print PrimeCandidate Thanks
The indentation starting from the second 'if'. -- http://mail.python.org/mailman/listinfo/python-list
