SlideShare une entreprise Scribd logo
1  sur  16
1
PRESENTATION ON PYTHON
By Rohit Kumar Verma
B. Tech (CSE)
2
Intorduction
 Python is a general purpose high level programming language.
 Python was developed by Guido Van Rossam in 1989 while working at
National Research Institute at Netherlands.
 But officially Python was made available to public in 1991. The official Date
of Birth for Python is : Feb 20th 1991.
 Python is recommended as first programming language for beginners.
 It is interpreted , object oriented and procudural language
 Python language is being used by almost all tech-giant companies like –
Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.
 There are two major Python versions- Python 2 and Python 3. Both are quite
different.
3
Program to add two no.
Java program
public class Add{
pulic static void main(String []args){
Int a,b;
a=10;
b=20;
System.out.println(“Addition is =”+(a+b))
}
}
C-Program
void main()
{
int a,b;
a =10;
b=20;
printf("The Sum:%d",(a+b));
}
Python program
a,b=10,20
print(“the sum is =”,(a+b))
4
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 Language Features from Perl and Shell Script .
4. Modular Programming Features from Modula-3 .
5. Most of syntax in Python Derived from C and ABC languages.
5
Where we can use python
We can use everywhere. The most common important application areas are
1) For developing Desktop Applications
2) For developing web Applications
3) For developing database Applications
4) For Network Programming
5) For developing games
6) For Data Analysis Applications
7) For Machine Learning
8) For developing Artificial Intelligence Applications
9) For IoT
6
Features of Python
 Simple and easy to learn
 Open source
 High level Programming language
 Platform Independent
 Portability
 Dynamically Typed
 Both Procedural Oriented and Object Oriented
 Interpreted
 Extensible
 Embedded
 Extensive Library
7
Python version
 Python 1.0V introduced in Jan 1994
 Python 2.0V introduced in October 2000
 Python 3.0V introduced in December 2008
 Current version of python 3.8.0, documentation released on 14
October 2019.
Note: Python 3 won't provide backward compatibility to Python2 i.e
there is no guarantee that Python2 programs will run in Python3.
8
Reserved Words in Python
 In Python some words are reserved to represent some meaning or functionality.
Such types of words are called reserved words.
 There are 33 reserved words available in Python.
True, False, None
and, or ,not,is
if, elif, else
while, for, break, continue, return, in, yield
try, except, finally, raise, assert
import, from, as, class, def, pass, global, nonlocal, lambda, del, with
Note:
1. All Reserved words in Python contain only alphabet symbols.
2. Except the following 3 reserved words, all contain only lower case alphabet symbols
True,False,None
9
Data Type in Python
 Data type represent the type of data present inside a variable
 In python , Based on value provided , the type will be automatically assigned .
Python contain following inbuilt datatype
Int Float Complex Bool
Str Bytes Bytearray Range
List Tuple Set Frozenset
Dict None
10
Operators in python
 Arithmetic Operator ( + , - , / , * , % , // , ** )
 Relational Operator ( > , < , <= , >= )
 Equality operator( == , != )
 Logical Operator( and , or , not )
 Bitwise Operator ( & , | , ^ , ~ , << , >> )
 Assignment Operator ( += , -= , /= , *= , %= , //= , **= ,&= , |= , ^= , << =, >>=)
 Special operator and member operator(is ,in)
Operator chaining
10<20<30<40 True 10<20<60<50 False
possible in relational operator and equality operator (==)
11
Decorator
Decorator is a fuction which take fuction as argument and extends its functionality and return modified function
def hello_decorator(func):
def inner1():
print("Hello, this is before function execution")
func()
print("This is after function execution")
return inner1
@hello_decorator or function_to_be_used = hello_decorator(function_to_be_used)
def function_to_be_used():
print("This is inside the function !!")
function_to_be_used()
Output:
Hello, this is before function execution
This is inside the function !!
This is after function execution
12
Generator
 A Function which is used to generate sequence of values .
 It is similar to ordinary function
 It uses yield keyword to return sequence values
def simpleGeneratorFun():
yield 1
yield 2
yield 3
for value in simpleGeneratorFun():
print(value)
Output :-
1
2
3
13
Zipping and Unzipping files
 To perform zipping operation
create zip file class object with name of zip file
f = ZipFile(“files.zip”,”w”,”ZIP_DEFLATED”)
Now, we can add files by using write() method
f.write(filename)
 To perform unzip operation
f=ZipFile(“files.zip”,” r ”, ZIP_STORED )
now , we can get all files names present in that zip file by using namelist() method
names = f.namelist()
14
Working With Dorectories
 python provides inbuilt module os , which contain several function to perform directories related operation
 To know current working directory
cwd = os.getcwd()
 To created sub directory in the current working directory
os.mkdir(“dirName”)
 To create multiple subdirectories like sub1 in that sub2 in that sub3
os.makedirs(“sub1/sub2/sub3”)
 To remove directoriy
os.rmdir(“name”)
 To rename the directory
os.rename(“mysub”,”newdir”)
15
__name__ , __init__
__name__
 Since there is no main() function in Python, when the command to run a python program
is given to the interpreter, the code that is at level 0 indentation is to be executed.
__name__ special variable and it has two values
1. __main__ ( if program is executed as indivisual program )
2.module’s name (it the program is executed as module from another program)
__init__
 if a folder or directory contain __init__.py file , is considered as a python package.
 __init__ is used for constructor of a class
16
Python Limitations
 Performance and Speed
 Incompatibility of Two Versions
 Requires Additional Testing
 Not use for mobile applications

Contenu connexe

Tendances (20)

Python basics
Python basicsPython basics
Python basics
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Beginning Python Programming
Beginning Python ProgrammingBeginning Python Programming
Beginning Python Programming
 
Python PPT
Python PPTPython PPT
Python PPT
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode1.python interpreter and interactive mode
1.python interpreter and interactive mode
 
Python
PythonPython
Python
 
Python ppt
Python pptPython ppt
Python ppt
 
Basics of python
Basics of pythonBasics of python
Basics of python
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Variables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaVariables & Data Types In Python | Edureka
Variables & Data Types In Python | Edureka
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Programming
ProgrammingProgramming
Programming
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
Python Modules
Python ModulesPython Modules
Python Modules
 
Python ppt
Python pptPython ppt
Python ppt
 

Similaire à Python ppt

First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python ProgrammingDozie Agbo
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfExaminationSectionMR
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answersRojaPriya
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answerskavinilavuG
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
 
Functions_in_Python.pptx
Functions_in_Python.pptxFunctions_in_Python.pptx
Functions_in_Python.pptxkrushnaraj1
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experiencedzynofustechnology
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAdam Getchell
 
Python intro
Python introPython intro
Python introrik0
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxusvirat1805
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMRaveen Perera
 

Similaire à Python ppt (20)

First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
 
Python for dummies
Python for dummiesPython for dummies
Python for dummies
 
Pythonpresent
PythonpresentPythonpresent
Pythonpresent
 
Introduction of Python
Introduction of PythonIntroduction of Python
Introduction of Python
 
Pyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdfPyhton-1a-Basics.pdf
Pyhton-1a-Basics.pdf
 
Interview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdfInterview-level-QA-on-Python-Programming.pdf
Interview-level-QA-on-Python-Programming.pdf
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Spsl iv unit final
Spsl iv unit  finalSpsl iv unit  final
Spsl iv unit final
 
Spsl iv unit final
Spsl iv unit  finalSpsl iv unit  final
Spsl iv unit final
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
Functions_in_Python.pptx
Functions_in_Python.pptxFunctions_in_Python.pptx
Functions_in_Python.pptx
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
An Overview Of Python With Functional Programming
An Overview Of Python With Functional ProgrammingAn Overview Of Python With Functional Programming
An Overview Of Python With Functional Programming
 
Python and You Series
Python and You SeriesPython and You Series
Python and You Series
 
Python intro
Python introPython intro
Python intro
 
unit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptxunit (1)INTRODUCTION TO PYTHON course.pptx
unit (1)INTRODUCTION TO PYTHON course.pptx
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 

Plus de Rohit Verma

Containerization and version control system
Containerization and version control systemContainerization and version control system
Containerization and version control systemRohit Verma
 
Library manaementreport1
Library manaementreport1Library manaementreport1
Library manaementreport1Rohit Verma
 
Blockchain tutorial
Blockchain tutorial Blockchain tutorial
Blockchain tutorial Rohit Verma
 
blockchain unit 3
blockchain unit 3blockchain unit 3
blockchain unit 3Rohit Verma
 
Use case of block chain unit 4 AKTU
Use case of block chain unit 4 AKTUUse case of block chain unit 4 AKTU
Use case of block chain unit 4 AKTURohit Verma
 
Hyper ledger febric
Hyper ledger febricHyper ledger febric
Hyper ledger febricRohit Verma
 
java 8 new features
java 8 new features java 8 new features
java 8 new features Rohit Verma
 

Plus de Rohit Verma (7)

Containerization and version control system
Containerization and version control systemContainerization and version control system
Containerization and version control system
 
Library manaementreport1
Library manaementreport1Library manaementreport1
Library manaementreport1
 
Blockchain tutorial
Blockchain tutorial Blockchain tutorial
Blockchain tutorial
 
blockchain unit 3
blockchain unit 3blockchain unit 3
blockchain unit 3
 
Use case of block chain unit 4 AKTU
Use case of block chain unit 4 AKTUUse case of block chain unit 4 AKTU
Use case of block chain unit 4 AKTU
 
Hyper ledger febric
Hyper ledger febricHyper ledger febric
Hyper ledger febric
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 

Dernier

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 

Dernier (20)

Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 

Python ppt

  • 1. 1 PRESENTATION ON PYTHON By Rohit Kumar Verma B. Tech (CSE)
  • 2. 2 Intorduction  Python is a general purpose high level programming language.  Python was developed by Guido Van Rossam in 1989 while working at National Research Institute at Netherlands.  But officially Python was made available to public in 1991. The official Date of Birth for Python is : Feb 20th 1991.  Python is recommended as first programming language for beginners.  It is interpreted , object oriented and procudural language  Python language is being used by almost all tech-giant companies like – Google, Amazon, Facebook, Instagram, Dropbox, Uber… etc.  There are two major Python versions- Python 2 and Python 3. Both are quite different.
  • 3. 3 Program to add two no. Java program public class Add{ pulic static void main(String []args){ Int a,b; a=10; b=20; System.out.println(“Addition is =”+(a+b)) } } C-Program void main() { int a,b; a =10; b=20; printf("The Sum:%d",(a+b)); } Python program a,b=10,20 print(“the sum is =”,(a+b))
  • 4. 4 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 Language Features from Perl and Shell Script . 4. Modular Programming Features from Modula-3 . 5. Most of syntax in Python Derived from C and ABC languages.
  • 5. 5 Where we can use python We can use everywhere. The most common important application areas are 1) For developing Desktop Applications 2) For developing web Applications 3) For developing database Applications 4) For Network Programming 5) For developing games 6) For Data Analysis Applications 7) For Machine Learning 8) For developing Artificial Intelligence Applications 9) For IoT
  • 6. 6 Features of Python  Simple and easy to learn  Open source  High level Programming language  Platform Independent  Portability  Dynamically Typed  Both Procedural Oriented and Object Oriented  Interpreted  Extensible  Embedded  Extensive Library
  • 7. 7 Python version  Python 1.0V introduced in Jan 1994  Python 2.0V introduced in October 2000  Python 3.0V introduced in December 2008  Current version of python 3.8.0, documentation released on 14 October 2019. Note: Python 3 won't provide backward compatibility to Python2 i.e there is no guarantee that Python2 programs will run in Python3.
  • 8. 8 Reserved Words in Python  In Python some words are reserved to represent some meaning or functionality. Such types of words are called reserved words.  There are 33 reserved words available in Python. True, False, None and, or ,not,is if, elif, else while, for, break, continue, return, in, yield try, except, finally, raise, assert import, from, as, class, def, pass, global, nonlocal, lambda, del, with Note: 1. All Reserved words in Python contain only alphabet symbols. 2. Except the following 3 reserved words, all contain only lower case alphabet symbols True,False,None
  • 9. 9 Data Type in Python  Data type represent the type of data present inside a variable  In python , Based on value provided , the type will be automatically assigned . Python contain following inbuilt datatype Int Float Complex Bool Str Bytes Bytearray Range List Tuple Set Frozenset Dict None
  • 10. 10 Operators in python  Arithmetic Operator ( + , - , / , * , % , // , ** )  Relational Operator ( > , < , <= , >= )  Equality operator( == , != )  Logical Operator( and , or , not )  Bitwise Operator ( & , | , ^ , ~ , << , >> )  Assignment Operator ( += , -= , /= , *= , %= , //= , **= ,&= , |= , ^= , << =, >>=)  Special operator and member operator(is ,in) Operator chaining 10<20<30<40 True 10<20<60<50 False possible in relational operator and equality operator (==)
  • 11. 11 Decorator Decorator is a fuction which take fuction as argument and extends its functionality and return modified function def hello_decorator(func): def inner1(): print("Hello, this is before function execution") func() print("This is after function execution") return inner1 @hello_decorator or function_to_be_used = hello_decorator(function_to_be_used) def function_to_be_used(): print("This is inside the function !!") function_to_be_used() Output: Hello, this is before function execution This is inside the function !! This is after function execution
  • 12. 12 Generator  A Function which is used to generate sequence of values .  It is similar to ordinary function  It uses yield keyword to return sequence values def simpleGeneratorFun(): yield 1 yield 2 yield 3 for value in simpleGeneratorFun(): print(value) Output :- 1 2 3
  • 13. 13 Zipping and Unzipping files  To perform zipping operation create zip file class object with name of zip file f = ZipFile(“files.zip”,”w”,”ZIP_DEFLATED”) Now, we can add files by using write() method f.write(filename)  To perform unzip operation f=ZipFile(“files.zip”,” r ”, ZIP_STORED ) now , we can get all files names present in that zip file by using namelist() method names = f.namelist()
  • 14. 14 Working With Dorectories  python provides inbuilt module os , which contain several function to perform directories related operation  To know current working directory cwd = os.getcwd()  To created sub directory in the current working directory os.mkdir(“dirName”)  To create multiple subdirectories like sub1 in that sub2 in that sub3 os.makedirs(“sub1/sub2/sub3”)  To remove directoriy os.rmdir(“name”)  To rename the directory os.rename(“mysub”,”newdir”)
  • 15. 15 __name__ , __init__ __name__  Since there is no main() function in Python, when the command to run a python program is given to the interpreter, the code that is at level 0 indentation is to be executed. __name__ special variable and it has two values 1. __main__ ( if program is executed as indivisual program ) 2.module’s name (it the program is executed as module from another program) __init__  if a folder or directory contain __init__.py file , is considered as a python package.  __init__ is used for constructor of a class
  • 16. 16 Python Limitations  Performance and Speed  Incompatibility of Two Versions  Requires Additional Testing  Not use for mobile applications