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
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