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

XI-IP-I-Getting Started With Python-Module 5-5-2021

This document provides an introduction to Python including its key features, limitations, and the basics of how to work with Python. It discusses Python's origins, features like being an easy to use OO language with simple syntax and being cross-platform. It also covers limitations like not being the fastest language. The document then explains how to install Python and work with it in both interactive and script modes, including creating and running a simple Python program.

Uploaded by

Raju Upadhyay
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

XI-IP-I-Getting Started With Python-Module 5-5-2021

This document provides an introduction to Python including its key features, limitations, and the basics of how to work with Python. It discusses Python's origins, features like being an easy to use OO language with simple syntax and being cross-platform. It also covers limitations like not being the fastest language. The document then explains how to install Python and work with it in both interactive and script modes, including creating and running a simple Python program.

Uploaded by

Raju Upadhyay
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Chapter 2 – Introduction to Python-Module-I

Module 1:Python – Features, Limitations, Working in Python

Basics of Python programming, Python interpreter - interactive and script mode, the structure of a program,
indentation, identifiers, keywords, constants, variables, types of operators, precedence of operators, data
types, mutable and immutable data types, statements, expressions, evaluation and comments, input and
output statements, data type conversion, debugging.

Basics of Python programming:


Introduction:
Python is a very popular programming language, created by Guido van Rossum in 1991. It is used in a
variety of fields, including software development, web development, scientific computing, big data and
Artificial Intelligence.

It is based on two languages – ABC language and Modula-3

Python was named after famous BBC comedy show namely Monty Python’s Flying Circus. Original release
- Oct 1969 -1974
Pluses/Features of Python :
1.Easy to use OO language- It is compact and very easy to use object oriented language with very simple
syntax rules.

2. Expressive language- It is more capable to express the codes purpose than any other language
because of fewer lines of code, simpler syntax. Less code to be written as it itself express the purpose of
the code.

For example:
In C++:Swap values In Python: Swap values
int a = 2, b=3,tmp; a,b=2,3
tmp=a; a,b=b,a
a=b;
b=tmp;

3. Interpreted language- Python installation interprets and executes the code line by line at a time.
4. Completeness – Support wide range of library

5. Free & Open Source – Can be downloaded freely and source code can be modify for
improvement.

6. Cross-Platform - It can run on windows, Linux, Macintosh etc. equally. Portable

7. Variety of usage-

Scripting Rapid protoyping

Web Applications GUI Programs

Game Development Database Applications

LIMITATIONS OF PYTHON

1. Not the fastest Language Its not fully compiled one as its interpreter based. Its first semi-complied into

an internal byte code which is then exerted by a Python Interpreter. Execution times are not that fast as

compared to compiled languages however its development time is faster.

2. Lesser libraries – as compared to other programming languages like c++, java.net

2. Slow language – as it is interpreted languages, it executes the program slowly.

3. Weak / Not strong at Type-binding – It not pin point on use of a single variable for different

data type.

4. Not easily Convertible-Because of its lack of syntax, Python is an easy language to program in.
Python installation process

Note – Download only that python distribution/MSI Installer, which is best suited for the
Operating system on which you want to install it.

Python installation process


1. Double-click the icon labeling the file <version>.exe

Popup window will appear

Click on Run option


2. Setup popup window will appear

If the Python Installer finds an earlier version of Python installed on your computer, the Install Now message will
instead appear as Upgrade Now(and the checkboxes will not appear).
3. User Account Control pop-up window will appear

Click the Yes button.

4. A new Python <version> Setup pop-up window will appear with a Setup

Progress message and a progress bar.


Click the close button

After installation of python ,we can work on it in following ways

(i) in Interactive mode

(ii) in Script mode


(i) in Interactive mode

* Search the python.exe file in the drive in which it is installed.

If found double click it to start python in interactive mode

* Click start button -> All programs ->

python<version>->IDLE(Python GUI)
Python Prompt

Type the following at prompt

print “hello Pat-Pun-Ludh-Coim”

print 8*3

k=3+4*3

print k
(ii) in Script mode

Step 1 (Create program file)

Below steps are for simple hello world program

a. Click Start button->All Programs ->


Python<version>->IDLE

b. Now click File->New in IDLE Python Shell

Now type :

Print “hello”

Print “world”

print “python is”,”object oriented programming lang.”

c. Click File->Save and then save the file with filename and .py extension

(ii) in Script mode

Step 2 (Run program file)

a. Click Open command from IDLE’s File menu and select the file
you have already saved

b. Click Run-> Run Module

c. It will execute all the commands of program file and display


output in separate python shell window

Page 13 of 14
Assignment Questions:
1. What is Python?
2. What is the purpose of PYTHONSTARTUP environment variable?
3. Evaluate the output generated
>>>print 3.14159* 7**2
>>>print “I”, “am” + “class XI”, “student”
>>>print “I‟m”,
>>>print “class XI student”
>>>print “I‟m “, 16, “years old”

4. When will following statement in interpreter result into error:


>>> B+4
5. How can we change the value of 6*1-2 to -6 from 4?

Page 14 of 14

You might also like