Given the way you set it up, you would get that 26 is a prime. Since it is only divisible by 13, and 13 is not yet in the table, it will fall through the while. You need to find all primes less than the number that you ask for to populate your table, or set the program find the first n primes.
I notice that the else on the if is in the wrong indentation.
You should use the modulo operator on the if and not division as you my be getting integer division and not floating point.
I put the fix in the code below.
Note that the problem is that you are using extend when you should be using append.
append vs. extend
append
: Appends object at end.
x = [1, 2, 3]
x.append([4, 5])
print (x)
gives you: [1, 2, 3, [4, 5]]
extend
: Extends list by appending elements from the iterable.
x = [1, 2, 3]
x.extend([4, 5])
print (x)
gives you: [1, 2, 3, 4, 5]
Here is the code set up using modulo for the test rather than division. This shows the correct situation. Note that when doing division and getting a floating point result isinstance() may not give the correct answer. There are a number of sources that recommend not using that as a test.
If you are using Python 3.0, then you would be getting a floating point response rather than an int answer. See Python integer division yields float
prime = [2,3,5,7]
get = int(input("what number do you want to check ? "))
a = 0
while a < len(prime):
print("Test " + str(a+1))
if (get % prime[a]) == 0:
# Number was evenly divisible by a prime number
print(str(get) + " is not a prime number" )
break
else:
a += 1
else:
# Number was not evenly divisible by primes already in table
prime.append(get)
print(str(get) + " is a prime number, prime number added to list"