Question: Write a function named prime_factors that takes an integer as a parameter and returns a list containing all its smallest prime factors. For example, the

Write a function named prime_factors that takes an integer as a parameter and returns a list containing all its smallest prime factors. For example, the number 120 has prime factors of 2, 2, 2, 3, 5, so the function should return: [2, 2, 2, 3, 5] For example: Test Result print(prime_factors(120)) [2, 2, 2, 3, 5] print(prime_factors(26)) [2, 13]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
