Python installation provides a code environment to execute in the following mode

  • Interactive mode
  • Scripting mode

Python installation provides the following things

  • Interpreter
  • Python Shell
  • Python IDLE Editor

programmer writes a program that contains Python commands or API code, Runs the code with an interpreter, and outputs the result.

Interactive mode can be enabled using Operation System terminal python Shell or IDLE editor.

How to Open Terminal in Python Interactive Mode

  • Open terminal,
  • In Windows, Open the Run dialog or use Window + R command, type cmd.exe or search in the start menu for command prompt
  • in Mac, Go to Applications, Next Utilities, Select Terminal It should be like after opening the command line in Windows
  • Type python in the command line, next, press the Enter key, You should see the following output.
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> in the above last line tells that you are in Python Interactive mode. If you did not see the above message, then Python is not installed correctly, Please follow python installation

You can run help() commands

>>> help()

Welcome to Python 3.11's help utility!

If this is your first time using Python, you should check out
the tutorial is on the internet at

Enter the name of any module, keyword, or topic to get help with writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", and type "modules spam".


Or you can write Python code blocks.

For example, run Hello Word program

>>> print("hello");
>>> m=5;
>>> n=4;
>>> m+n;

Python Scripting mode

Scripting mode enables you to run Python programs.

Programs contain multiple code blocks saved in a file with the extension .py.

  • Create in a text editor
  • Copy the below code into the file, and save it.
  • Open Terminal
  • Run the following command with the file