Question: I have written a code to find out if a number is prime or composite.
The code works fine when I input a prime number but when I input a composite number the output is:

```
enter number: 100
The number is not prime.
The number is prime.

```

I don't want `The number is prime` output for composite number input.
Here is my code:

```
print ('This program tells whether the number is prime or not')
print ('')

def prime(x):
  if x < 2:
    print('The number is not prime.')
  else:
    for n in range(2, x - 1):
      if x % n == 0:
        print('The number is not prime.')
        break
    print('The number is prime.')

i = input('enter number: ')
prime(int(i))

```

Please tell me what can I do to correct it.

Answer: 
I can see why. you are missing else after if. try this:

```
print ('This program tells whether the number is prime or not')
print ('')

def prime(x):
  if x < 2:
    print('The number is not prime.')
  else:
    for n in range(2, x - 1):
      if x % n == 0:
        print('The number is not prime.')
        break
    else:
        print('The number is prime.')

i = input('enter number: ')
prime(int(i))

```
```
if num > 1:
   for n in range(2, x-1):
      if x % n == 0:
         print('The number is not prime.')
         break
   else:
      print('The number is prime.')
else:
    print('The number is not prime.')

```

Simply fix that indentation in the for loop. Also, this looks a lot cleaner.