 Python Tutorial

# Python Program To Check Number Is Prime or Not

## What is prime number ?

A prime number is a number which divides only by 1 or number itself.

Number is a prime number or not, we need to divide it successively by all numbers from 2 to one less than that number. if remainder value for any of these division is zero then that number is not a prime number.

## Prime Number Python Program

This python program is used to identify whether a number is prime number or not.

```#!/usr/bin/python

def check_prime_number(num):
index = 2;
while (index <= num-1):
if (num % index == 0):
return False;
index += 1;
if (index == num ):
return True;
return False;

if __name__ == '__main__':
num = int(input("Enter number: "));
is_prime_number = check_prime_number(num);
if is_prime_number:
print("%d is a prime number!" % num);
else:
print("%d is not a prime number!" % num);
```
Output:
```\$ python prime_number.py
Enter number: 32
32 is not a prime number!
\$ python prime_number.py
Enter number: 33
33 is not a prime number!
\$ python prime_number.py
Enter number: 5
5 is a prime number!
```     