import math

def is_prime(n):
    if n % 2 == 0 and n > 2:
        return False
for i in range(3, int(math.sqrt(n)) + 1, 2):
    if n % i == 0:
        return False
return True
Python Prime number checker