I aim is to have a simple logic to find prime numbers between 2 ranges. However to start simple, i am trying to have a code that evaluates a number input if it is prime and i am failing at it. Though i am able to evaluate it to some degree the final print statement is off. How do i ensure that the final print only happens when the previous loop is done and did not succeed?
n = int(input ('The number'))
if n <2:
print (n,' is not a prime number')
elif n==2:
print (n, ' is a prime number')
else:
i = 2
while i<n:
if n%i ==0:
print (n, ' is not a prime number')
break
else:
i +=1
print (n, " is a prime number")