# Python Program to check a number is prime or not using class

In this program, you will learn how to check a number is prime or not using class in Python.

`Some list of prime numbers : 2 3 5 7 11 13`

## Example: How to check a number is prime or not using class in Python

```
class Test:
def __init__(self, num):
self.num = num
def check(self):
i = 2
flag = 1
while i <= self.num / 2:
if num % i == 0:
flag = 0
break
i = i + 1
if flag == 1:
print("Number is prime:", self.num)
else:
print("Number is not prime:", self.num)
def result(self):
print("Sum is ", self.z)
num = int(input("Enter a number:"))
obj = Test(num)
obj.check()
```

#### Output:

```
Enter a number:13
Number is prime: 13
```