Ad
Functional Programming

The task before:
A prime factor is a factor that is a prime number. Prime numbers are numbers that have exactly two distinct positive divisors: 1 and the number itself. For example, the first six prime numbers are 2, 3, 5, 7, 11, and 13.

The function prime_factors should take an integer as input. The integer will always be greater than 1.

def prime_factors(n):
    divider = lambda x: next((i for i in range(2, x) if x % i == 0), -1)

    return ([] if n == 1 else [n]) if divider(n) == -1 else ([divider(n)] + prime_factors(n // divider(n)))