Not a complicate question but I couldn't find an explicit answer around.
For example, if I want to find out the number of prime numbers in a list of numbers:
def count_prime(lst):
    """lst is a list of integers"""
    def isPrime(n):
        return all(n % div != 0 for div in range(2, int(n**0.5) + 1)) if n > 1 else False
    result = 0
    for num in lst:
        if isPrime(num):
            result += 1
    return result
This looks very simple, but I put isPrime(n) inside of the main function.
How does it compare to:
def isPrime(n):
    return all(n % div != 0 for div in range(2, int(n**0.5) + 1)) if n > 1 else False
def count_prime(lst):
    """lst is a list of integers"""
    result = 0
    for num in lst:
        if isPrime(num):
            result += 1
    return result
My question is: Does it make any difference? Which one is preferred?
 
    