In this article, you will get to know How Does Python Work.
We all know nowadays python became very popular in the IT industry. Python is well known for Artificial intelligence (AI) and Machine Learning (ML). These are not only two fields where it’s popular. However, day by day python increasing its popularity in Web Development sector also. To be honest I am also a Python fan, not the one that represents snake 🙂 🙂 :).
Let’s see how does python work
We all know computers only understand ones and zeros a combination of ones and zeros known as a binary digit. But what if I say computers only understand voltage yeah that’s true and these ones and zeros are nothing but voltage. Ahhh…. I am getting out of the topic we will discuss these computer related things later in another post.
To The Topic
Python is an interpreted language. And it doesn’t get converted into machine code like C or C++ but what it does, it compiles into byte code. Then after generating the byte code Python Virtual Machine(PVM) converts it to machine readable code. And after that computer returns the output. Let’s make it more clear to understand. When someone writes a python program and executes it on the machine, first these code statements go to the python byte code translator. And then it translates the code into byte code, after translating the byte code it goes into Python Virtual Machine(PVM) and the Python Virtual Machine(PVM) makes these code machine readable code and then returns the output. Below I add an image to show you the process visually.
Moreover, you can see the compiled byte code in filename.pyc or in the filename.pyo file.
Is python easy to learn?
In my opinion, Yes. And I think one can get a basic understanding of python in just 3 months. If someone comes from C or C++ then python will be much easier for that person.
I hope this will article will be helpful for you to understand the process. You can learn python from the official site.