isprime python

def isPrime(n):
    if n==2:
        return True
    if n%2==0:
        return False
    for i in range(3,int(n**0.5)+1):
        if n%i==0:
            return False
    return True

Here is what the above code is Doing:
1. If n is 2, return True.
2. If n is even, return False.
3. For all odd numbers from 3 to the square root of n, if n is divisible by i, return False.
4. If n is not divisible by any of the above numbers, return True.