Are there any logical or syntax errors in the below code ? Can the following Python code generate prime numbers in the interval [lower,upper] ? 

def primes(lower, upper):
    """Returns all the prime numbers within the specified interval [lower, upper] as a list."""
    primes = []
    for num in range(lower, upper+1):
        if num > 2:
            # Checks if number has any factors other than itself and 1
            not_factorized = True
            for i in range(2, int(num**0.5)+1):
                if (num % i) == 0:
                    not_factorized = False
            if not_factorized:
                primes.append(num)
    return primes