Python Programming – Introduction to Python Interpreter and Program Execution

You can learn about Introduction to Python Programming Programs with Outputs helped you to understand the language better.

Python Programming – Introduction to Python Interpreter and Program Execution

A program is a sequence of instructions given to the computer to perform a specific task. A programming language consists of a set of codes for writing down the instructions that the computer will follow. Programmers also refer to their programs as com¬puter code, and the process of writing an algorithm in a programming language is called coding.

Python is a powerful high-level, object-oriented programming language. It has a simple easy-to-use syn¬tax to learn computer programming. For example, the addition of two numbers can be expressed more logically and is easier to understand. You know that a computer understands only the machine language (also known as low-level language). So, you need to translate the high-level language into the machine language that the computer can execute. The high-level program is called source code, and the resulting machine code (object code) is a program that the computer can directly execute.

There are two ways to do this: a high-level language can either be compiled or interpreted. In compila¬tion, source code is first converted to object code (See Figure 3.1). Then the object code is executed to get the output. An interpreted language is a language that is read in its raw form and executes a statement at a time without being first compiled. An interpreter is a program that translates one state¬ment of a high-level language program into machine code and executes it, and then translates and executes the next statement of the program and so on and so forth.
In this way, it proceeds further till all the statements of the program are translated and executed one after the other. Figure 3.2 shows the structure of the interpreter.

Python Programming – Introduction to Programming chapter 3 img 40

  • Interpreted languages run more slowly because the translation takes place line-by-line. However, development and debugging are faster.

Python is considered as an. interpreted language because:
(a) Python programs are executed by an interpreter, not by a compiler.
(b) A program written in a compiled language, such as C or C++ is converted from the source language, i.e./C or C++ into a binary code, i.e., Os . and Is) using a compiler. When you run the program, the linker/loader software copies the 1 program from hard disk to memory and starts
running it. Python, on the other hand, does not need to be converted into binary. You just run the program directly from the source code.

  • Python is an interpreted, object-oriented, and high-level programming language with dynamic semantics.

Leave a Reply

Your email address will not be published. Required fields are marked *