Answer:
num = int(input("Num: "))
if num > 1:
for i in range(2,num):
if (num % i) == 0:
print(num,"is a composite number")
break
else:
print(num,"is a prime number")
else:
print(num,"is neither prime nor composite")
Explanation:
This line prompts user for input
num = int(input("Num: "))
The following if condition check for prime, composite or neither both
if num > 1:
The following iteration checks for prime or composite
for i in range(2,num):
This if condition tests if a valid divisor can be gotten. If yes, then input number is composite
<em> if (num % i) == 0: </em>
<em> print(num,"is a composite number")</em>
<em> break</em>
<em />
If otherwise, then input number is prime
<em> else:</em>
<em> print(num,"is a prime number")</em>
<em />
All numbers less than 2 are neither composite nor prime
else:
print(num,"is neither prime nor composite")