Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

1. Which is the most abundant gas presented in the atmosphere?

Answered: 1 week ago