What is Data Abstraction in Python?


What is Data Abstraction in Python?

The hiding of implementation details of the process and showing required information to the user is called Data Abstraction.

Example:: 

Take example of below output::


In the above output we are asking users two numbers and showing the sum. But we are not showing how addition is done internally. This is called Abstraction.

Actually the two inputs taken from the user are converted into int data type and stored in two different variables. Then they are converted into binary form and then perform their binary addition and then convert binary sum to decimal number sum and store it in a variable. This is what actually done by the program. But it is showing sum of two numbers which is required to the user. This is called Abstraction.

Once see the output if there is no Abstraction implemented by Python


Crazy right ! 😄

Here in the above examples I explained inbuilt python Abstraction. Actually there is no term inbuilt Abstraction, just for explanation I have added it.

Like how python gives 5 as output if we type 2 + 3 in python interpreter, likewise our programs also should be written by giving only required information and Hiding complexities. NOW Let us come to the real implementation of data Abstraction in python.
It is done through Abstract method.

Post a Comment

0 Comments