Execution modes of Python

There are two ways to use the Python interpreter:
a) Interactive mode
b) Script mode

Interactive mode

To work in the interactive mode, we can simply type a Python statement on the >>> prompt directly. As soon as we press enter, the interpreter executes the statement and displays the result.
Working in the interactive mode is convenient for testing a single line code for instant execution but we cannot save the statements for future use.

Script mode

In the script mode, we can write a Python program in a file, save it and then use the interpreter to execute it.


Python scripts are saved as files where file name has extension “.py”. Python scripts are saved in the Python installation folder as a default location.


When we run (execute) the program using "Run" option or "F5" key, then the output will be shown on different window i.e. an interactive mode only.