Question: Using Python Q8: Is Prime? Write a function that returns True if a positive integer n is a prime number and False otherwise. Hint: use
Using Python
Q8: Is Prime?
Write a function that returns True if a positive integer n is a prime number and False otherwise. Hint: use the % operator: x % y returns the remainder of x when divided by y.
| def is_prime(n): """ >>> is_prime(10) False >>> is_prime(7) True """
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
