0% found this document useful (0 votes)
72 views

To Install Python, Firstly Download The Python Distribution From

The document provides instructions for installing and using Python. It describes how to download and install Python from the official website. It then gives a simple "Hello World" example Python program and explains how to run Python code interactively from the command line or by writing scripts and running them from the command line or using an IDE like IDLE. It covers the different modes for working with Python like interactive, script, and using an IDE.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

To Install Python, Firstly Download The Python Distribution From

The document provides instructions for installing and using Python. It describes how to download and install Python from the official website. It then gives a simple "Hello World" example Python program and explains how to run Python code interactively from the command line or by writing scripts and running them from the command line or using an IDE like IDLE. It covers the different modes for working with Python like interactive, script, and using an IDE.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Installation of PYTHON :

1. To install Python, firstly download the Python distribution from www.python.org/download.

2. Having downloaded the Python distribution now execute it. Double click on the
downloaded software. Follow the steps for installation:
3.

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Click the Finish button and Python will be installed on your system.

Python Example
Python code is simple and easy to run. Here is a simple Python code that will print "Welcome to
Python".

A simple python example is given below.

>>> a="Welcome To Python"


>>> print a
Welcome To Python

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

How to execute python :


There are three different ways of working in Python:

1) Interactive Mode:
You can enter python in the command prompt and start working with Python.

Press Enter key and the Command Prompt will appear like:

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Now you can execute your Python commands.

Eg:

2) Script Mode:
Using Script Mode , you can write your Python code in a separate file using any editor of your
Operating System.

Save it by .py extension.

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Now open Command prompt and execute it by :

NOTE: Path in the command prompt should be where you have saved your file. In the above case file
should be saved at desktop.

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

3) Using IDE: (Integrated Development Environment)


You can execute your Python code using a Graphical User Interface (GUI).

All you need to do is:

Click on Start button -> All Programs -> Python -> IDLE(Python GUI)

You can use both Interactive as well as Script mode in IDE.


1) Using Interactive mode:
Execute your Python code on the Python prompt and it will display result simultaneously.

2) Using Script Mode:

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

i) Click on Start button -> All Programs -> Python -> IDLE(Python GUI)
ii) Python Shell will be opened. Now click on File -> New Window.
A new Editor will be opened . Write your Python code here.

Click on file -> save as

Run then code by clicking on Run in the Menu bar.

Run -> Run Module

Result will be displayed on a new Python shell as:

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

P.V.P SIDDHARTHA INSTITUTE OF TECHNOLOGY

You might also like