Question: You should create a function called is_prime that has one integer parameter, value. This function will return True if the number passed is a prime

You should create a function called is_prime that has one integer parameter, value. This function will return True if the number passed is a prime number and False if the number is not. A number if prime if it can only be divided by one and itself, a number is not prime if it can be divided by a number from 2 to value - 1. ( Actually up to the sqrt(value) ).

is_prime(7) True

is_prime(3) True

is_prime(4) False

is_prime(8) False

Output:

## Create is_prime function

if __name__ == "__main__": # Anything code that is not the funciton should be indented under this if. DO NOT REMOVE print(is_prime(7)) print(is_prime(3)) print(is_prime(4)) print(is_prime(8))

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!