How to Execute Python Program

Python can be executed in various ways but before it is advisable that one understands the methods thoroughly so that it can be sued for the right applications. Since this is a programming language which can be used for different applications each has its own way of execution. There are basically three different methods of executing the python - we shall discuss them here.

The first one being the interactive mode - in case of interactive mode the programmer can enter the python language using the command prompt. Once the prompt is given the person can start working on this language easily.

Next in order to work further you need to press the enter key and then start executing the python commands.

Script mode is the next method used for execution of python - here you can write your code in a separate file - save the same with .py extension and then use for execution.

There are three different ways of working in Python

  • Script Mode
  • Interactive Mode
  • Using IDE (Integrated Development Environment)

Script Mode

If you using Script Mode , you can write your Python code in a separate file using any editor like (Notepad, Notepad ++,) of your Operating System.


Next Step :- Save it by .py extension.


Next Step:- Now open Command window for execute python code


Finaly Get output of this code


Interactive Mode Execute Program
Using IDE (Integrated Development Environment) Execute Program