UrbanPro
true

Learn Python Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Steps of Execution of a Python Program

Manoj S.
06/07/2021 0 0

When we compile a Python program, the python compiler converts the Python source code into another code called byte code. Byte code is a fixed set of instructions that represent different types of operations. This code can run on any Operating System and hardware. So mainly, byte code instructions are platform-independent.

The size of each byte code instruction is one byte, and thats why they are called the name byte code.

Now we need to convert the byte code to machine understandable code, which comprises 0s and 1s. This machine understandable code is called machine code.

So Python uses an interpreter called PVM (Python Virtual Machine), which understands the byte code and converts it into machine code.

After that, these machine code instructions are executed by the processor and results are displayed.

(pic: Google)

                               See the source image

We can view the python byte code files (.pyc).

First, write a program in any text editor and save it with .py

now, compile the program using python compiler.

for example, if your file name is test.py, then use the following syntax

c:\> python test.py

To see the byte code instructions created by the python compiler before they are executed by the PVM, execute the following command.

c:\>python -m dis test.py

Here -m represents the module named dis. This module is also known as 'disassembler' that displays the byte code in the human-understandable format.

The above command will display the byte code of the test.pyc file creates during the compilation of the test.py file.

That is the way to view the byte code.

Thanks!

0 Dislike
Follow 2

Please Enter a comment

Submit

Other Lessons for You

How To Prepare For CBSE Class 12 Board Exam ?
How to prepare for the CBSE Class 12 Board Exam? In this lesson, I will teach you how to prepare for the CBSE Class 12 Board Exam. Your class 12 board exam is probably the most important exam in your...
A

Abraham Paul

3 0
0

Cardiovascular System
The circulatory system consists of a network of artery, veins and pumping organ called the heart. The additional is the lymphatic system which is discussed separately. The circulatory system essentially...
A

Animesh R.

1 0
0

Quick Revision Strategy
With exam season fast-approaching, it’s essential to start thinking about managing, planning, and effectively utilising your time. Revision plays a vital role in scoring good in your examination....

Logarithm with JEE Example
JEE 2011 Question on Logarithm Let (x0,y0) be the solution of the following equations: (2x)ln2 = (3y)ln3 3lnx = 2lnyThen x0 is(A)1 6(B)1 3(C)1 2(D) 6Answer and Comments: (C). We can treat the data as...

Economics
CENTRAL PROBLEMS OF AN ECONOMY AND THEIR SOLUTIONS ‘Economy’ refers to the nature and level of economic activities in an area, which may be a village, a city, a town, a district, a state...
S

Shipra

0 0
0

Looking for Python Training classes?

Learn from Best Tutors on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Python Training Classes?

The best tutors for Python Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Python Training with the Best Tutors

The best Tutors for Python Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more