Create a Python function that takes a number as a parameter and check the number is
PRIME or NOT.
I need the code to have an output stated above.
def prime(num):
if num > 1:
for i in range(2, int(num/2)+1):
if (num % i) == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")
else:
print(num, "is not a prime number")
number = int(input("Enter number: "))
prime(number)
Comments
Leave a comment