Why doesn't the loop in the following code work?
#Finds out what numbers are prime.
primes = [2,3,5,7,11,13,17,19,23]
finish = int(raw_input("What number would you like to check to? "))
start = 24
while start >= finish:
x = 0
while start % primes[x] != 0:
if IndexError:
break
else:
x = x + 1
else:
primes.append[start]
start = start + 1
print primes
When run, it just prints out the default set of primes after taking the number you want the program to check up to.
Swat spam before it fills your inbox!