Mine never defines is_prime():
def all_prime_elements(sequence):
"""Returns every prime element of the sequence."""
return [x for x in sequence if is_prime(x)]
def all_prime_factors(sequence):
"""Returns every prime factor of the sequence."""
return [x for x in sequence if is_prime(x) and x!= 1]
def all_prime_factors_with_limit(sequence, limit):
"""Returns every prime factor of the sequence up to the given limit."""
return [x for x in sequence if is_prime(x) and x!= 1]
def all_prime_factors_with_limit_and_step(sequence, limit, step):
"""Returns every prime factor of the sequence up to the given limit."""
return [x for x in sequence if is_prime(x) and x!= 1]
def all_prime_factors_with_limit_and_step_and_start(sequence, limit, step, start):
"""Returns every prime factor of the sequence up to the given limit."""
return [x for x in sequence if is_prime(x) and x!= 1]
def all_prime_factors_with_limit_and_step_and_start_and_end(sequence, limit, step, start, end):
"""Returns every prime factor of the sequence up to the given limit."""
return [x for x in sequence if is_prime(x) and x!= 1]
def all_prime_factors_with_limit_and_step_and_start_and_end_and_step(sequence, limit, step, start, end, step):
"""Returns every prime factor of the sequence up to the given limit."""
return [x for x in sequence if is_prime(x) and x!= 1]
(and so on)