PYTHON
LECTURE 1
Today’s Agenda
An Introduction to Python
• Necessity Of Programming
• What Is Python ?
• Why And Who Created It ?
• What Python Can Do ?
• Why Should I Learn Python In 2019 ?
• Important Features
Why Do We Need Programming ?
• To communicate with digital machines and make them
work accordingly
• Today in the programming world , we have more than
850 languages available.
• And every language is designed to fulfill a particular
kind of requirement
Brief History Of Prog. Lang
 C language was primarily designed to develop “System
Softwares” like Operating Systems, Device Drivers etc .
 To remove security problems with “C” language , C++
language was designed.
 It is an Object Oriented Language which provides data
security and can be used to solve real world problems.
 Many popular softwares like Adobe Acrobat , Winamp Media
Player,Internet Explorer,Mozilla Firefox etc were designed in
C++
Courtsey:http://www.stroustrup.com/applications.html
What is Python ?
 Python is a general purpose and powerful
programming language.
 Python is considered as one of the most versatile
programming language as it can be used to develop
almost any kind of application including desktop
application , web applications , mobile
application , network programming , image
processing and many more.
Who created Python ?
 Developed by Guido van
Rossum , a Dutch scientist
 Created at Center For
Mathematics and
Research , Netherland
 It is inspired by another
programming language
called ABC
Why was Python
created ?
 Guido started Python
development as a hobby in
1989
 But since then it has grown to
become one of the most
polished languages of the
computing world.
How Python got
it’s name?
 The name Python is inspired
from Guido’s favorite
Comedy TV show called
“Monty Python’s Flying
Circus”
 Guido wanted a name that
was short, unique, and
slightly mysterious, so he
decided to call the language
Python.
Who manages Python
today ?
 From version 2.1 onwards ,
Python is managed by
Python Software
Foundation situated in
Delaware , USA
 It is a non-profit
organization devoted to the
growth and enhancement of
Python language
 Their website is
http://www.python.org
What Python can do ?
 GUI Application
 Web Application
 Data Analysis
 AI & ML
 Raspberry Pi
 Hacking
GUI In Python
 Python is used for GUI
apps all the time.
 It has famous libraries
like PyQT , Tkinter to
build desktop apps.
Web Application
In Python
 We can use Python to
create web
applications on many
levels of complexity
Famous Websites Developed
Using Python
 There are numerous examples of popular, high-
load websites/webapps that have been developed
using Python.
 Here are some of the most popular of them:
 NASA
 Instagram
 Mozilla
 Spotify
 Reddit
 Dropbox
 And above all YouTube
Web Application
In Python
 There are many
excellent Python
frameworks like
Django, Flask for web
application
development
Data Analysis In Python
 Data Analysis is about
making predictions
with data
Some Examples
 How do you think Super
Market stores decide
what products to keep in
stock?
 What are the items they
should club together to
make a combo?
 How it happens ?
 Answer: Data analytics
Some Examples
 Have you noticed that
every time you log on to
Google, Facebook and
see ads, they are based
on your preferences ?
 How it happens ?
 Answer: Data analytics
Data Analysis In Python
 Python is the leading
language of choice for
many data scientists
 It has grown in
popularity due to it’s
excellent libraries like
Numpy , Pandas etc
AI & ML
In Python
 Machine learning is a field
of AI (Artificial
Intelligence) by using
which software
applications can learn to
increase their accuracy for
the expecting outcomes.
 It is heavily used in Face
recognition , music
recommendation ,
medical data etc
 Python has many wonderful
libraries to implement ML
algos like SciKit-Learn ,
Tensorflow etc
Raspberry Pi
In Python
 The Raspberry Pi is a
low cost, credit-card
sized computer that
plugs into a computer
monitor or TV, and
uses a standard
keyboard and mouse.
 It can do almost
everything a normal
desktop can do
Raspberry Pi
In Python
 We can build Home
Automation System
and even robots using
Raspberry-Pi
 The coding on a
Raspberry Pi can be
performed using
Python
Hacking In Python
 Python has gained
popularity as
preferred language for
hacking.
 Hackers generally
develop small scripts
and Python provides
amazing performance
for small programs
Why should
I learn Python ?
 3rd most popular programming
 Fastest growing language
 Opens lots of doors
 Big corporate prefer Python
 Means , PYTHON IS THE
FUTURE
Who uses Python
today ?
Features Of Python
 Simple
 Dynamically Typed
 Robust
 Supports multiple programming paradigms
 Compiled as well as Interpreted
 Cross Platform
 Extensible
 Huge Library
Simple
 Python is very simple
 As compared to other popular languages like Java and
C++, it is easier to code in Python.
 Python code is comparatively 3 to 5 times smaller than
C/C++/Java code
Print Hello Bhopal!
IN C
#include <stdio.h>
int main(){
printf("Hello Bhopal!");
return 0;
}
IN JAVA
public class HelloWorld{
public static void main( String[] args ) {
System.out.println( "Hello Bhopal!" );
}
}
IN PYTHON
print('Hello Bhopal!')
Add 2 Nos
IN C
#include <stdio.h>
int main(){
int a=10,b=20;
printf(“Sum is %d”,a+b);
return 0;
}
IN JAVA
public class HelloWorld{
public static void main( String[] args ) {
int a=10,b=20;
System.out.println( “Sum is “+(a+b));
}
}
IN PYTHON
a,b=10,20
print(“Sum is”,a+b)
Swap 2 Nos
IN C
int a=10,b=20,temp;
temp=a;
a=b;
b=temp;
IN JAVA
int a=10,b=20,temp;
temp=a;
a=b;
b=temp;
IN PYTHON
a,b=10,20
a,b=b,a
Dynamically Typed
Dynamically Typed
IN Python
a=10
a=“Bhopal”
IN C
int a;
a=10;
a=“Bhopal”;
Robust
 Python has very strict rules which every program must
compulsorily follow and if these rules are violated then Python
terminates the code by generating “Exception”
 To understand python’s robustness , guess the output of the
following /C++ code:
int arr[5];
int i;
for(i=0;i<=9;i++)
{
arr[i]=i+1;
}
Robust
 In Python if we write the same code then it will generate
Exception terminating the code
 Due to this other running programs on the computer do
not get affected and the system remains safe and secure
Supports Multiple
Programming Paradigms
 Python supports both procedure-oriented and object-
oriented programming which is one of the key python
features.
 In procedure-oriented languages, the program is built
around procedures or functions which are nothing but
reusable pieces of programs.
 In object-oriented languages, the program is built
around objects which combine data and functionality
Compiled
As Well As Interpreted
 Python uses both a compiler as well as interpreter for
converting our source and running it
 However , the compilation part is hidden from the
programmer ,so mostly people say it is an interpreted
language
Cross Platform
 Let’s assume we’ve written a Python code for our
Windows machine.
 Now, if we want to run it on a Mac, we don’t need to make
changes to it for the same.
 In other words, we can take one code and run it on any
machine, there is no need to write different code for
different machines.
 This makes Python a cross platform language
Extensible
 Python allows us to call C/C++/Java code from a
Python code and thus we say it is an extensible language
 We generally use this feature when we need a critical piece
of code to run very fast .
 So we can code that part of our program in C or C++ and
then use it from our Python program.
Huge Library
 The Python Standard Library is huge indeed.
 It can help you do various things like Database
Programming , E-mailing ,GUI Programming etc