PYTHON
LECTURE 1
Today’s Agenda
• Prerequisites Of Learning Python
• Necessity Of Programming
• What Is Python ?
• Why And Who Created It ?
• What Python Can Do ?
• Why Should I Learn Python In 2020 ?
• Important Features
• Course Outline
What You Should Know ?
To start learning Python , there is no strict pre-requisite
No specific programming language knowledge is needed.
Just basic knowledge in C/C++ is more than sufficient
Why Do We Need Programming ?
• To communicate with digital machines and make them
work accordingly
• Today in the programming world , we have more than 900
programming 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,MS Office 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 applications
web applications
IoT applications
AI , ML and Data Science applications
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
Where Is Python used ?
GUI
Web
Data Science
AI & ML
IoT
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
Udemy
Spotify
Mozilla
Dropbox
And above all YouTube
Web Application In Python
There are many excellent
Python frameworks like
Django, Flask for web
application development
Data Science In Python
Data Science is about
making predictions with
data
Some Examples
How do you think Super
Market stores decide
what are the items they
should club together to
make a combo?
How it happens ?
Answer: Data Science
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 Science
Data Science 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
predict more accurate
outcomes based on
historical data.
It is heavily used in Face
recognition , music
recommendation ,
medical data etc
Use Of ML In COVID-19
AI & ML In Python
Python has many
wonderful libraries to
implement ML algos like
SciKit-Learn , Tensorflow
etc
IoT In Python
The Internet of Things, or
IoT, refers to the billions
of physical devices
around the world that are
now connected to the
internet, all collecting
and sharing data.
For example:
A lightbulb that can be
switched on using a
smartphone app is an IoT
device
IoT In Python
We can build Home
Automation System and
even robots using IoT
The coding on an IoT
platform like 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 corporates 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 C IN Python
int a;
a=10
a=10;
a=“Bhopal”; 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/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 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