## Brute testing to find the prime. A better solution would be ## to create a list with already found primes and only use numbers ## from that list when checking with division. ## Assumed this kind of code would be expected for this assignment. list = [3+n for n in range (10000) if n%2 == 0] # prime number candidates to be used later prime = 2 count = 1 for i in range(0,10000): if count == 1000: print '1000th prime number is ', prime break else: test = list[i] # Candidate to be tested, i eth element on the previously created list for o in range (0,i+1): # loop to get all the numbers up to i eth number in the list divtest = list[o] if test%divtest == 0 and o == i: prime = test count +=1 elif test%divtest == 0 and o!= i: break