SlideShare a Scribd company logo
PRESENTATION ON PYTHON
SETH JAI PARKASH MUKAND LAL INSTITUTE OF ENGINEERING AND TECHNOLOGY, RADAUR
PRESENTED BY :
ABHISHEK
1220162
B.TECH (CSE) 2ND YEAR
INDEX :
 Introduction To Python
 Operators & Data Type
 Conditions & Loops
 Function & Exceptional Handling
 Classes & Inheritance
 Python Libraries
 Project On Python
 Queries
Introduction to Python
 Python is a popular programming language. It was
created by Guido van Rossum, and released in 1991.
 It is used for:
 Web Development (server-side),
 Software Development,
 Mathematics,
 System Scripting.
OPERATORS & DATA TYPES
OPERATORS :
 Arithmetic Operators
 Comparison (Relational) Operators
 Assignment Operators
 Logical Operators
 Bitwise Operators
 Membership Operators
 Identity Operators
DATA TYPES :
 Numbers
 String
 List
 Tuple
 Dictionary
Conditions & loops
 if statement : if statement is the most simple decision-making statement. It is
used to decide whether a certain statement or block of statements will be
executed or not .
 if-else : The if statement alone tells us that if a condition is true it will execute
a block of statements and if the condition is false it won’t. But what if we want
to do something else if the condition is false.
Python programming language provides following types of loops to handle
looping requirements.
 while loop : Repeats a statement or group of statements while a given
condition is TRUE. It tests the condition before executing the loop body.
 for loop: Executes a sequence of statements multiple times and abbreviates the
code that manages the loop variable.
 nested loops : We can use one or more loop inside any another while, for or
do..while loop.
FUNCTIONS AND EXCEPTION HANDLING
The try-expect statement
 If the Python program contains suspicious code that may throw the
exception, we must place that code in the try block.
 The try block must be followed with the except statement, which
contains a block of code that will be executed if there is some exception
in the try block.
A function is a block of organized, reusable code that is used to perform a
single, related action. Functions provide better modularity for your
application and a high degree of code reusing.
Calling a Function
 Call by Value
 Call by Reference
 Call by Address
Classes & inheritance
 Python is an object oriented programming language. Almost everything in Python is an
object, with its properties and methods. A Class is like an object constructor, or a
"blueprint" for creating objects.
 To understand the meaning of classes we have to understand the built-in __init__()
function. All classes have a function called __init__(), which is always executed when
the class is being initiated. Use the __init__() function to assign values to object
properties, or other operations that are necessary to do when the object is being created.
 Inheritance allows us to define a class that inherits all the methods and properties from
another class. Parent class is the class being inherited from, also called base class. Child
class is the class that inherits from another class, also called derived class.
 Single Inheritance
 Multiple Inheritance
 Multilevel Inheritance
PYTHON LIBRARIES
NUMPY :
 NumPy is a Python library used for working with arrays.
 It also has functions for working in domain of linear algebra, fourier
transform, and matrices.
 NumPy was created in 2005 by Travis Oliphant. It is an open source
project and you can use it freely.
 NumPy stands for Numerical Python.
PANDAS :
 Pandas is a Python library used for working with data sets.
 It has functions for analyzing, cleaning, exploring, and manipulating data.
 Pandas allows us to analyze big data and make conclusions based on
statistical theories.
 The name "Pandas" has a reference to both "Panel Data", and "Python
Data Analysis" and was created by Wes McKinney in 2008.
Project
LIBRARY
In this project, We create a Library Class which includes
i). Display Book
ii). Lend Book
iii). Add Book
iv). Return Book
Create a Object and passing Parameters in the Constructors.
Create a main function and run an infinite while loop that asks the
users for their input whether they want to display,lend,add or return
the book.
Code :
class Library():
def __init__(self,list_of_books,library_name): #constructor
self.list_of_books = list_of_books
self.library_name = library_name
self.lend_dict = {}
def display_book(self): #display function display the list of
books
print(f"nWe Have Following Books In {self.library_name}")
for item in self.list_of_books:
print(item)
def lend_book(self,user,book): #lend function is for lending a
book from library
if book not in self.lend_dict.keys():
self.lend_dict.update({book:user})
print("Lender-Book database has been updated. You Can Take Your Book Now")
else:
print(f"Book is Already being used by {self.lend_dict[book]}")
def add_book(self,book): #add function is for adding a book in Library
self.list_of_books.append(book)
print("Book has been added to the book List")
def return_book(self,book): #return function is for return the book in library
self.lend_dict.pop(book)
if __name__ == '__main__': # main function starts
bookandname = Library(["LET US C", "DSA", "C++", "PYTHON", "JAVA"], "ABHISHEK'S LIBRARY")
while True:
print(f"nn..............WELCOME TO {bookandname.library_name}..............")
name = input("Enter Your Name : ")
print(f"nHii {name.capitalize()} Welcome to {bookandname.library_name}")
choose = int(input("nPress 1 to Display Bookn"
"Press 2 to Lend Bookn"
"Press 3 to Add Bookn"
"Press 4 To Return Book : "))
if choose == 1:
bookandname.display_book()
elif choose == 2:
book = input("Enter the name of book you want to lend : ")
user = input("Enter Your Name : ")
bookandname.lend_book(user,book)
elif choose == 3:
book = input("Enter the name of book you want to add : ")
bookandname.add_book(book)
elif choose == 4:
book = input("Enter the name of book you want to add : ")
bookandname.return_book(book)
else:
print("Please Enter Valid Number")
choice = input("nEnter Q to quit or C to Continue : ")
if choice == "Q":
exit()
elif choice == "C":
continue #while loop continue after entering C
else:
print("Enter Q or C only")
OUTPUT :
..............WELCOME TO ABHISHEK'S LIBRARY..............
Enter Your Name : Chirag
Hii Chirag Welcome to ABHISHEK'S LIBRARY
Press 1 to Display Book
Press 2 to Lend Book
Press 3 to Add Book
Press 4 To Return Book :
IF WE PRESS 1 THEN:
We Have Following Books In ABHISHEK'S LIBRARY:
LET US C
DSA
C++
PYTHON
JAVA
ANY QUERY????
THANK YOU!!

More Related Content

Similar to PRESENTATION ON PYTHON.pptx

PYTHON PPT.pptx
PYTHON PPT.pptxPYTHON PPT.pptx
PYTHON PPT.pptx
AbhishekMourya36
 
Shivam PPT.pptx
Shivam PPT.pptxShivam PPT.pptx
Shivam PPT.pptx
ShivamDenge
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
RohitKumar639388
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft Presentation
Travis Oliphant
 
Government Polytechnic Arvi-1.pptx
Government Polytechnic Arvi-1.pptxGovernment Polytechnic Arvi-1.pptx
Government Polytechnic Arvi-1.pptx
ShivamDenge
 
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
ExaminationSectionMR
 
Python training
Python trainingPython training
Python training
Kunalchauhan76
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Mohammed Rafi
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
zynofustechnology
 
14-Python-Concepts for data science.pptx
14-Python-Concepts for data science.pptx14-Python-Concepts for data science.pptx
14-Python-Concepts for data science.pptx
ShekharBabar1
 
Python ppt
Python pptPython ppt
Python ppt
Rohit Verma
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
Kevlin Henney
 
bhaskars.pptx
bhaskars.pptxbhaskars.pptx
bhaskars.pptx
NaveenShankar34
 
presentation_intro_to_python
presentation_intro_to_pythonpresentation_intro_to_python
presentation_intro_to_python
gunanandJha2
 
presentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.pptpresentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.ppt
MohitChaudhary637683
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
Swarit Wadhe
 
Introduction to Python Programming Language For Artificial Intelligence
Introduction to Python Programming Language For Artificial IntelligenceIntroduction to Python Programming Language For Artificial Intelligence
Introduction to Python Programming Language For Artificial Intelligence
saraahmed870035
 
обзор Python
обзор Pythonобзор Python
обзор Python
Yehor Nazarkin
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
IruolagbePius
 
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptxPYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
mru761077
 

Similar to PRESENTATION ON PYTHON.pptx (20)

PYTHON PPT.pptx
PYTHON PPT.pptxPYTHON PPT.pptx
PYTHON PPT.pptx
 
Shivam PPT.pptx
Shivam PPT.pptxShivam PPT.pptx
Shivam PPT.pptx
 
pythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptxpythontraining-201jn026043638.pptx
pythontraining-201jn026043638.pptx
 
Standardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft PresentationStandardizing arrays -- Microsoft Presentation
Standardizing arrays -- Microsoft Presentation
 
Government Polytechnic Arvi-1.pptx
Government Polytechnic Arvi-1.pptxGovernment Polytechnic Arvi-1.pptx
Government Polytechnic Arvi-1.pptx
 
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 training
Python trainingPython training
Python training
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
14-Python-Concepts for data science.pptx
14-Python-Concepts for data science.pptx14-Python-Concepts for data science.pptx
14-Python-Concepts for data science.pptx
 
Python ppt
Python pptPython ppt
Python ppt
 
Python Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & stylePython Foundation – A programmer's introduction to Python concepts & style
Python Foundation – A programmer's introduction to Python concepts & style
 
bhaskars.pptx
bhaskars.pptxbhaskars.pptx
bhaskars.pptx
 
presentation_intro_to_python
presentation_intro_to_pythonpresentation_intro_to_python
presentation_intro_to_python
 
presentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.pptpresentation_intro_to_python_1462930390_181219.ppt
presentation_intro_to_python_1462930390_181219.ppt
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
Introduction to Python Programming Language For Artificial Intelligence
Introduction to Python Programming Language For Artificial IntelligenceIntroduction to Python Programming Language For Artificial Intelligence
Introduction to Python Programming Language For Artificial Intelligence
 
обзор Python
обзор Pythonобзор Python
обзор Python
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptxPYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
 

Recently uploaded

Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 

Recently uploaded (20)

Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 

PRESENTATION ON PYTHON.pptx

  • 1. PRESENTATION ON PYTHON SETH JAI PARKASH MUKAND LAL INSTITUTE OF ENGINEERING AND TECHNOLOGY, RADAUR PRESENTED BY : ABHISHEK 1220162 B.TECH (CSE) 2ND YEAR
  • 2. INDEX :  Introduction To Python  Operators & Data Type  Conditions & Loops  Function & Exceptional Handling  Classes & Inheritance  Python Libraries  Project On Python  Queries
  • 3. Introduction to Python  Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.  It is used for:  Web Development (server-side),  Software Development,  Mathematics,  System Scripting.
  • 4. OPERATORS & DATA TYPES OPERATORS :  Arithmetic Operators  Comparison (Relational) Operators  Assignment Operators  Logical Operators  Bitwise Operators  Membership Operators  Identity Operators DATA TYPES :  Numbers  String  List  Tuple  Dictionary
  • 5. Conditions & loops  if statement : if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not .  if-else : The if statement alone tells us that if a condition is true it will execute a block of statements and if the condition is false it won’t. But what if we want to do something else if the condition is false. Python programming language provides following types of loops to handle looping requirements.  while loop : Repeats a statement or group of statements while a given condition is TRUE. It tests the condition before executing the loop body.  for loop: Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.  nested loops : We can use one or more loop inside any another while, for or do..while loop.
  • 6. FUNCTIONS AND EXCEPTION HANDLING The try-expect statement  If the Python program contains suspicious code that may throw the exception, we must place that code in the try block.  The try block must be followed with the except statement, which contains a block of code that will be executed if there is some exception in the try block. A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. Calling a Function  Call by Value  Call by Reference  Call by Address
  • 7. Classes & inheritance  Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects.  To understand the meaning of classes we have to understand the built-in __init__() function. All classes have a function called __init__(), which is always executed when the class is being initiated. Use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created.  Inheritance allows us to define a class that inherits all the methods and properties from another class. Parent class is the class being inherited from, also called base class. Child class is the class that inherits from another class, also called derived class.  Single Inheritance  Multiple Inheritance  Multilevel Inheritance
  • 8. PYTHON LIBRARIES NUMPY :  NumPy is a Python library used for working with arrays.  It also has functions for working in domain of linear algebra, fourier transform, and matrices.  NumPy was created in 2005 by Travis Oliphant. It is an open source project and you can use it freely.  NumPy stands for Numerical Python. PANDAS :  Pandas is a Python library used for working with data sets.  It has functions for analyzing, cleaning, exploring, and manipulating data.  Pandas allows us to analyze big data and make conclusions based on statistical theories.  The name "Pandas" has a reference to both "Panel Data", and "Python Data Analysis" and was created by Wes McKinney in 2008.
  • 9. Project LIBRARY In this project, We create a Library Class which includes i). Display Book ii). Lend Book iii). Add Book iv). Return Book Create a Object and passing Parameters in the Constructors. Create a main function and run an infinite while loop that asks the users for their input whether they want to display,lend,add or return the book.
  • 10. Code : class Library(): def __init__(self,list_of_books,library_name): #constructor self.list_of_books = list_of_books self.library_name = library_name self.lend_dict = {} def display_book(self): #display function display the list of books print(f"nWe Have Following Books In {self.library_name}") for item in self.list_of_books: print(item) def lend_book(self,user,book): #lend function is for lending a book from library if book not in self.lend_dict.keys(): self.lend_dict.update({book:user}) print("Lender-Book database has been updated. You Can Take Your Book Now") else: print(f"Book is Already being used by {self.lend_dict[book]}")
  • 11. def add_book(self,book): #add function is for adding a book in Library self.list_of_books.append(book) print("Book has been added to the book List") def return_book(self,book): #return function is for return the book in library self.lend_dict.pop(book) if __name__ == '__main__': # main function starts bookandname = Library(["LET US C", "DSA", "C++", "PYTHON", "JAVA"], "ABHISHEK'S LIBRARY") while True: print(f"nn..............WELCOME TO {bookandname.library_name}..............") name = input("Enter Your Name : ") print(f"nHii {name.capitalize()} Welcome to {bookandname.library_name}")
  • 12. choose = int(input("nPress 1 to Display Bookn" "Press 2 to Lend Bookn" "Press 3 to Add Bookn" "Press 4 To Return Book : ")) if choose == 1: bookandname.display_book() elif choose == 2: book = input("Enter the name of book you want to lend : ") user = input("Enter Your Name : ") bookandname.lend_book(user,book) elif choose == 3: book = input("Enter the name of book you want to add : ") bookandname.add_book(book)
  • 13. elif choose == 4: book = input("Enter the name of book you want to add : ") bookandname.return_book(book) else: print("Please Enter Valid Number") choice = input("nEnter Q to quit or C to Continue : ") if choice == "Q": exit() elif choice == "C": continue #while loop continue after entering C else: print("Enter Q or C only")
  • 14. OUTPUT : ..............WELCOME TO ABHISHEK'S LIBRARY.............. Enter Your Name : Chirag Hii Chirag Welcome to ABHISHEK'S LIBRARY Press 1 to Display Book Press 2 to Lend Book Press 3 to Add Book Press 4 To Return Book :
  • 15. IF WE PRESS 1 THEN: We Have Following Books In ABHISHEK'S LIBRARY: LET US C DSA C++ PYTHON JAVA