python program to find prime number n by seeing if they can divide evenly into prime numbers less that the squareroot of n
<p>How do I make this return the right results for primes less than 10 ?</p>

<pre><code>from math import *

def isPrime(n):

i = [c for c in range(int(sqrt(n)),0,-1) if c % 2 != 0 and c &gt; 1 ]

for x in i: 
    if n % x == 0:
        return print('%s is not prime' % (n))
return print('%s is prime number' %(n))


def main():

loopCnt = 'y'
while loopCnt != 'n':
    n = int(input('Enter a integer greater than 2: '))
    isPrime(n)


    loopCnt = input('Enter any key to try again or enter n to exit').strip().lower()


main()
</code></pre>

<p>It is not giving the desired output</p>

<p>As suggested by @Duskwolf, the line where you check for primes is wrong. A replacement function could simply be </p>

<pre><code>import numpy as np

def isPrime(n):
    len = int(sqrt(n))
    divisors = np.zeros(len, dtype=np.bool)
    for i in range(1,len):
        if(n%(i+1)==0):
            divisors[i]=True
    prime = not divisors.any()
    if(prime):
        return print('%s is prime' % (n))
    return print('%s is not a prime number' %(n))
</code></pre>

python