Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The first picture is the instructions and the second picture is all the required doctests that must be passed. Thanks. Goal [10 pts] Write the
The first picture is the instructions and the second picture is all the required doctests that must be passed. Thanks.
Goal [10 pts] Write the recursive function isPrime(num) that takes an integer as a parameter and returns True if the number is prime, False otherwise. A prime number is a positive integer that has exactly two positive integer factors, 1 and itself. You can assume the function only receives positive integers, return Boolean values isPrime(num) must be a recursive function, otherwise, no credit is given - - If needed, the function could take a second argument, but it will not be provided by the user. This means it should be a preloaded value and the original function call will be fed only with n Remember to consider the special cases def isPrime (n): >>> isPrime (5) True >isPrime (1) False >>> isPrime (9) False >>> is Prime (85) False >> isPrime (1019) True - Your code starts here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started