Q. Write a Python function that takes a number as a parameter and checks whether the number is prime or not.
Answer =
def prime(a): for i in range (2,a) : if a % i == 0 : return "This is not prime number" return "Prime number" a = int(input("Enter a number : ")) print(prime(a))
Output :-
Enter a number : 3
Prime number
>>>
Enter a number : 6
This is not prime number
>>>
Ty
ReplyDeleteTy
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )