from math import sqrt, ceil


def isPrime(x):
    """Primality test.

    Param x: int.

    Returns True if x is prime, False otherwise.
    """
    if x <= 0:
        return False
    elif x == 2 or x == 3:
        return True
    else:
        for i in range(2, ceil(sqrt(x)) + 1):
            if x % i == 0:
                return False
        return True


if __name__ == "__main__":
    strNum = input("Enter number to check if prime (-1 to quit): ")
    while strNum != '-1':
        num = int(strNum)
        print(isPrime(num))
        strNum = input("Enter number to check if prime (-1 to quit): ")

from math import sqrt, ceil


def isPrime(x):
    """Primality test.

    Param x: int.

    Returns True if x is prime, False otherwise.
    """
    if x <= 0:
        return False
    elif x == 2 or x == 3:
        return True
    else:
        for i in range(2, ceil(sqrt(x)) + 1):
            if x % i == 0:
                return False
        return True


if __name__ == "__main__":
    strNum = input("Enter number to check if prime (-1 to quit): ")
    while strNum != '-1':
        num = int(strNum)
        print(isPrime(num))
        strNum = input("Enter number to check if prime (-1 to quit): ")

Primality test.      Param x: int.      Returns True if x is prime, False otherwise.