# Write a Boolean function named is_prime which takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Use the function in a program that prompts the user to enter a number and then prints whether the number is prime.

### CHALLENGE:

A prime number is a number that is only evenly divisble by itself and 1.
For example, the number 5 is prime because it can only be evenlly divided by 1
and 5. The number 6, however, is not prime because it can be divided evenly
by 2 and 3.

Write a Boolean function named is_prime which takes an integer as an argument
and returns true if the argument is a prime number, or false otherwise. Use
the function in a program that prompts the user to enter a number and then
prints whether the number is prime.

### SOLUTION:

```n=int(input("Enter an integer:"))
def is_prime(n):
if n<2:
return False
elif n==2:
return True
else:
i=2

while i<n:
if((n%i)==0):
return False
elif (n==27):
return False
else:
i+=1
return True

print(is_prime(n))

```

Posted in ,