Question: Write and test the following function: def detect _ prime ( number ) : - - - - - - - -
Write and test the following function:
def detectprimenumber: Determines if number is a prime number. Use: prime detectprimenumber Parameters: number an integer int Returns: prime True if number is prime, False otherwise bool
Add the function to a PyDev module named functions.py Test it from
A prime number is a positive integer greater than which has no other factors except and the number itself. and are prime numbers as they can only be divided by and by themselves to give a whole number. is not a prime because, can be divided by and
The function does not ask for input and does no printing that is done by your test program.
The function must use a while loop.
Sample execution:
detectprime True
Step by Step Solution
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
