Write a script that determines whether or not a user-inputted number is a prime number and prints "The number that you inputted is a prime number" or "The number that you inputted is not a prime number" depending on what your script finds.
I have code that is failing some of the test cases and I'm not sure why. I see some answers on here that involve calculate the sqrt, but I don't understand why that'd be beneficial.
num= int(input())
if num == 0 or num ==1:
print('The number you inputted is not a prime number.')
while num < 0:
break
if num > 0:
for i in range(2,num):
if num%i==0:
print('The number you inputted is not a prime number.')
break
else:
print('The number you inputted is a prime number.')
break
The code is always right when I try it with a few test cases, but it isn't passing my homework assignment.