It is also known as Python Interpreter or Python Shell. It is a quick way to execute the commands. It does not need any save file to run or test the code. It has auto-completion, built-in functions, command history, which helps a programmer explore the Python program. It can copy and paste the code. By setting the environment, we can launch the python modules that have been installed in the system.
$ cd environments
$ . my_env/bin/activate
Prefix “>>>” accepts the python syntax.
E.g., >>> print(“Hello World”)
Hello World
Prefix “…” accepts the multiple line code in the interpreter. To break this multiple line code command, you need to press Enter twice.
Python is a high-level programming language. Python script contains codes that are written in Python Language. The extension of the file is “.py.” To run a script, you need a python interpreter.
In this way each statement can be executed
The interactive interpreter prompt helps us when we are eager to know the output of individual statements of the code. We cannot write the code every time on the terminal because of each line execution. We need to write the whole code into our file which can or might be executed later.
For this purpose, we need to open an editor like notepad, create a file named first.py (Python used .py extension), and write the following code in it.
NOTE:- To run this code,this file is named as filename.py,after which we need to write py filename.py on the command prompt for the output.
|