Question: Lab04 - Exercise - Primes (2 points) Complete the function factors() in primes.py that factorises a number into its prime factors. The prime factors of

 Lab04 - Exercise - Primes (2 points) Complete the function factors()
in primes.py that factorises a number into its prime factors. The prime
factors of a number are all of the prime numbers that together

Lab04 - Exercise - Primes (2 points) Complete the function factors() in primes.py that factorises a number into its prime factors. The prime factors of a number are all of the prime numbers that together multiply to the original number. For example, the number 1e has prime factors 12, 51 as 2 * 5 = 10. The number 12 has prime factors (3, 2, 21 as 3 * 2 * 2 = 12 See the documentation for more details. Write tests for your factors function in a file primes_test.py. Ensure your tests have 100% coverage. Ensure your code is pylint compliant primes.py 251 Bytes Edit Web IDE Replace Delete 1 import math 2 3 def factors(num): 4 5 Returns a list containing the prime factors of 'num. The primes should be 6 listed in ascending order. 7 8 For example: >>> factors (16) 12, 2, 2, 21 11 >>> factors (21) 12 [3, 71 13 14 pass 9 10 primes_test.py 14 Bytes Co 1 import primes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!