top of page

Python: Installation and Executing Python Codes

Versions of Python

  • Python 1.0 introduced in Jan 1994 (almost gone)

  • Python 2.0 introduced in October 2000

  • Python 3.0 introduced in December 2008

We will talk about Python 2 and 3. Both are parallel versions and 3 is not advanced version of 2 and does not provides support for python 2. They are developed as independent programming languages.

Any new version of a software provides support for older version; this is the software rule and is known as backward compatibility. In Python there is no support for backward compatibility. Python-3 does not support Python-2 programmes. For example, code print “Namaste” valid in Python 2 is not valid in Python 3 (for Python 3 code is print (“Namaste”)). Long data type is there in Python 2 but not in Python 3.

Python Organization has ended support for python 2 from January 1, 2020. So, it is recommended to download python 3. Latest version of Python 3 (3.8.2) was released on Feb 25, 2020.

How to install Python

Go to

We are going to download 3.8.2

Installing Python
Installing Python

After installation of python, it is not required to set path manually. Click on Add Python 3.8 to path and path is automatically added.

Installing Python

Customize  if you don’t need all functions.

Click on install now.

Python Setup
Python Setup

What is the use of Path Environment variable


Whenever we are using any command like Java or Python immediately windows OS has to execute the corresponding exe file. If we use javac command then windows OS has to execute javac.exe file. From where it is going to execute javac.exe. System will search in the path environment variable. Path:loc1;loc2:loc3… if at any location it found then it is going to execute the exe file.

How many ways we can execute Python Code


Python provides one REPL Tool: Python IDLE. IDLE is an integrated development environment for Python, which has been bundled with the default implementation of the language since 1.5.2b1. It is packaged as an optional part of the Python packaging with many Linux distributions. It is completely written in Python and the Tkinter GUI toolkit. REPL: Read, Evolve, Print, Loop.



1. Print Namaste: Type print (“Namaste”) on Python IDLE .

First it will read the statement then evaluate statement then print it and then again get ready to read the new statement.

Path Environment
Executing Code thorugh Python IDLE

2. Run  Python Code through Command Promt

From the Command prompt type python or py it will starts the Python shell automatically.

Executing Python Code thorugh Command prompt

3: Run Python Code through Windows PowerShell:

From the Windows Power Shell type python or py it will starts the Python shell automatically.

Executing Code thorugh Windows PowerShell

Note 1: To Exit From Python Shell, use exit() command.

Note 2: Python shell is used for small coding snippet (just 2 or 3 lines of code). It is not recommended to write larger code on it. If you want to write a program, save your code inside a file, then execute that file.

Python Shell

There are many options in Python IDLE like:

File - Create new file, open existing file and many more

Edit - Undo, Redo , Copy, Paste

Shell - vie last start, restart shell, next and previous history

Debug - go to debugger

Options - configure IDLE

Windows - go to Python 3.8.2 shell

Help - About IDLE, Turtle graphics Examples


Python Clock

Round dance

Python Round Dance


Read some int values from the keyboard (dynamic input) print those many number of times message.

We are going to write this program in a file and then execute it.

Open Python IDLE

Click on File

Then Click on new File

Write the code

n = int(input("Enter some number"))

// enter a number and type casting in int

for i in range(n): // for loop

print("Hello how are you")

Python IDLE

Save the file with any name but extension must be .py. I have saved it with name

How to execute the file:

Click on run.

A new window will open. Provide your input for example 5.

Then it will print the message 5 times

Run Python Programme

Programme:3 Read two numbers from the keyboard (dynamic input) and print their Addition, Subtraction and Multiplication

Write This program in a file and save it (you can save with any name)

x=int(input("Enter First number"))

y=int(input("Enter Second number"))

Python Shell

Run file with cmd:

Change the path

Type the name of program (

Run Pyrhon Code through Command Prompt

In the previous examples we have used notepad.

Now we are going to used EditPlus editor (5.3 Evaluation Version)

EditPlus provides 30 days trail.

For installation Go to

Edit Plus Setup

Click on accept

Edit Plus Setup

Specify a path and then click on Start Copy

Edit Plus Setup

You will get a message click on OK.

Edit Plus Setup
Edit Plus Setup

Click on Trial

Edit Plus Setup

Various File Type Supported by EditPlus

Edit Plus Setup

Why EditPlus is required when notepad is there?

  • Debugging is easy in EditPlus.

  • Keywords in blue color and Functions in grey color.

  • More readable and easier to write codes.

You can also use Notepad++ for the same functionalities.

Python Code in Notepad
Python Code in EditPlus

When we will work to develop big application then we will use IDEs (Integrated Development Environment) in which 70% of the code is generated automatically. There are many IDEs like

  • PyCharm

  • Eclipse

  • Spyder

Note: When basic concepts are clear then we will use IDEs, till then we will work with Editors.

For any Query/Suggestion, do let us know in the comment section.

bottom of page