Python

Python Interpreter

What is a Python Interpreter?
The concept of an interpreter in computer programming refers to a program that executes a set of instructions without converting it into machine code. This is also applicable to the Python programming language. In Python, the code is executed one statement at a time.

Components
The interpreter in Python has two main components namely;
1. Translator – This checks the syntax of the code written and generates a byte code.
2. Virtual Machine – This converts the byte code into binary and executes it.

Working with the Python Interpreter
A Python program can be written and executed in two modes namely interactive and scripting modes.

Interactive mode
In this mode, we use a command line interface to invoke Python by simply typing “python”. The version of Python installed on the system in use will be displayed with a prompt “>>>” that denotes where to type Python commands.
python
>>> print("Hello there!")

Scripting mode
In this mode, we can execute a program saved as a Python script example “myProgram.py”. We simply invoke Python and specify the script to be executed.
python myProgram.py

What's your reaction?

Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

You may also like

Leave a reply

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

Time limit exceeded. Please complete the captcha once again.