Question: In TODO 2, you are going to write automatic tests for the is_prime function by completing the body of the test_is_prime function. The is_prime function
- In TODO 2, you are going to write automatic tests for the is_prime function by completing the body of the test_is_prime function. The is_prime function expects an integer greater than 0 as an argument. It outputs a boolean encoding whether the number is prime or not. A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. For example, 5 is prime because the only ways of writing it as a product, 1 × 5 or 5 × 1, involve 5 itself.
- Your task is to use several assert statements (within the test_is_prime function) with calls to the is_prime function using different arguments. The test_is_prime function can then be used to ascertain that the is_prime function returns the expected results. Note that you are required to implement at least 5 additional assert statements (there will be 6 in total).
- Choose the tests so that a correct implementation of the is_prime function passes but an incorrect implementation fails.
Step by Step Solution
★★★★★
3.53 Rating (167 Votes )
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
