What is Interpreter in Python? What is the types of Interpreter?

0
Interpreter in Python

Interpreter

Interpreter runs the code line by line. It read and run code line by line. Firstly, it executes the first line of the line then after it starts the execution of the second line. If the first line has some error then it will not move to the next line until the first line error got resolved.

Interpreter are of two types such as

  1. Interactive mode
  2. Script mode

1. Interactive mode

Interactive mode is a type of interpreter. This is interactive mode interface. Interactive mode runs only single line of code. It not worked on multiple lines of code. It is only used, when a user is confident with the code. Because, here we cannot update code. ‘>>>’ this represents that interpreter is ready to execute the code.

 

2. Script mode

Script mode is a second type of interpreter. Firstly, click on file and choose ‘New File’ option. That interface will be of script mode. In, script mode we can write and run single line and multiple lines of code. Code updation can be done at any point in script mode.

To write code in script mode. Firstly need to save the code file. Code file can be saved with any name. Code can be run directly with F5 button and another option is to press “Run module”. “Run module” comes under “Run” option. The result of script mode shown at interpreter shell. Code can be of single line and multiple lines. And if needed to update any line of code or word then it can be done with script mode. Script mode used more in comparison of “Interactive mode”.

 

 

About Author

Leave a Reply

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

Open chat
Hello
Can we help you?