INTRODUCTION TO
PYTHON
DEPARTMENT OF MECHANICAL ENGINEERING
DEFINITION
Python is a high-level, interpreted, interactive and object-oriented
scripting language.
Python is designed to be highly readable.
It uses English keywords frequently where as other languages use
punctuation, and it has fewer syntactical constructions than other
languages.
So, Python is programming language as well as scripting language
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
DIFFERENCE BETW EEN SCRIPTING AND PROGRAM LANGUAGE
Factor Scripting Language Programming Language
Type of language Interpreter based Compiler based
Usage To combine existing components To develop from scratch
Running Inside other program (dependent) Independent of a parent program
High level instructions converted to Full program converted to
Conversion
machine language machine language in one time
Design Makes coding simple and fast Gives full use of language
Compilation No need to compile Needs to compile first
File type Does not create a file type Creates a .exe file
Coding type It is a small piece of code It is a full code of a program
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
DIFFERENCE BETW EEN SCRIPTING AND PROGRAM LANGUAGE
Factor Scripting Language Programming Language
More time as you need to write
Time to develop Less time as required less code
the full code
Complexity Easy to write and use Difficult
Stand-alone compile result, no
Interpretation It is interpreted in another program need to be interpreted by another
program
Length Only a few and short lines of coding Numerous lines for every function
Hosting requirement Requires a host Self-executable, no host needed
Limited or no support to user Rich support to user interface
Support interface design, data types, and design, data types, and graphic
graphic design design
Cost Low maintenance High maintenance
JavaScript, PHP, Ruby, Perl, VB C, C++, Java, Pascal, C#, VB,
Example
Script, etc. Basic, COBOL, etc.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
HISTORY OF PYTHON
Python was developed by Guido van Rossum in the late eighties and
early nineties at the National Research Institute for Mathematics and
Computer Science in the Netherlands.
Guido developed python language by taking almost all programming
features from different languages
1. Functional programming features from C
2. Object oriented programming features from C++
3. Scripting languages features from Perl and Shell Script
4. Modular programming features from Modula – 3
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
VERSIONS
Python 1.0 was released on 20 February, 1991.
Python 2.0 was released on 16 October 2000
Python 3.0 was released on 3 December 2008
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
PYTHON FEATURES
Easy-to-learn
Easy-to-read
Easy-to-maintain
A broad standard library
Interactive Mode.
Portable
Extendable
Databases
GUI Programming
Scalable
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
WHO USES PYTHON TODAY?
Google
The popular YouTube video
The Dropbox
The Raspberry Pi
BitTorrent
Google‘s App Engine Maya
Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and
IBMNASA, Los Alamos, Fermilab, JPL, and others
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
WHERE WE CAN USE PYTHON
Web Applications
Desktop GUI Applications
Network Programming
Gaming Applications
Data Analysis Applications
Console Based Applications
Business Applications
Audio and Video Based Applications
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
WHAT ARE PYTHON’S TECHNICAL STRENGTHS?
1. It‘s Object-Oriented and Functional
2. It‘s Free
3. It‘s Portable
4. It‘s Powerful
5. It‘s Mixable
6. It‘s Relatively Easy to Use
7. It‘s Relatively Easy to Learn
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
DOWNLOAD AND INSTALLATION PYTHON SOFTWARE:
Step 1: Go to website www.python.org and click downloads select version which you
want.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 2: Click on Python 2.7.13 and download. After download open the file.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 3: Click on Next to continue. .
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 4: After installation location will be displayed. The Default location is C:\Python27.
Click on next to continue.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 5: After the python interpreter and libraries are displayed for installation. Click on Next
to continue
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 6: The installation has been processed..
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 7: Click the Finish to complete the installation.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 8: Setting up PATH to python:
Copy the Python installation location C:\Python27
Right-click the My Computer icon on your desktop and choose Properties. And then
select Advanced System properties.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 9: Go to Environment Variables and go to System Variables select Path and click on
Edit.
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G
Step 10 : Add semicolon (;) at end and copy the location C:\Python27 and give semicolon (;)
and click OK
D E PA R T M E N T O F M E C H A N I C A L E N G I N E E R I N G