# Abstraction:

It is one of the key concepts of object-oriented programming (OOP)languages. Its main goal is to handle the complexity by hiding unnecessary details from the user. This is a very common concept where you find it easily in the real world.

In Simple way if you are using a calculator that you have all the buttons to perform the action like addition, subtraction, multiplication and division and much more, you just have to press the corresponding button to perform the action you don’t know the logic of what the process has behind work.

Program 1:

```a=int(input("Enter first number"))
b=int(input("Enter second number"))
ch=int(input("Choice"))
if(ch==1):
print(a+b)
if(ch==2):
print(a-b)
if(ch==3):
print(a/b)
if(ch==4):
print(a*b)
else:
print("Wrong Number enter")
```

Output

```Enter first number12
Enter second number565
2 Subtract
3 Division
4 Multiply
Choice4
6780
```

A class derived from ABC(abstract base class) class which belongs to ABC module, is known as abstract in Python
ABC Class is known as meta class which means a class that defines the behavior of other class.Meta class ABC defines that the class which is derived from it becomes an abstract.

Rules of Define Abstract class

• Objects cannot create an abstract class.
• It is not required to declare all the methods in abstract class.
• If there is any abstract method in class that moment class should have abstract class.
• The abstract method of an abstract class must be defined in its child class.
• If you are inheritance any abstract class in child class then you should define the method in child class otherwise child class should be declared as abstract class.

Program 2:

```from abc import ABC,abstractmethod
class car(ABC):
@abstractmethod
def name(self):
pass
@abstractmethod
def color(self):
pass

class tata(car):
def name(self):
print("Swift")
def color(self):
print("White")
class hyundai(car):
def name(self):
print("Tucson")
def color(self):
print("Black")
class honda(car):
def name(self):
print("Civic")
def color(self):
print("Green")
obj=tata()
obj.name()
obj.color()
obj1=hyundai()
obj1.name()
obj1.color()
obj2=honda()
obj2.name()
obj2.color()

```

Output

```Swift
White
Tucson
Black
Civic
Green
```

Program 3:

```
from abc import ABC, abstractmethod

class absclass(ABC):

@abstractmethod
def do(self):
print("some work")

class secclass(absclass):

def do(self):
super().do()
print("another some work")

obj =secclass()
obj.do()
```

Output

```some work
another some work
```