SlideShare a Scribd company logo
CHAPTER - 03
PYTHON LIBRARIES
Unit I
Programming and Computational
Thinking (PCT-2)
(80 Theory + 70 Practical)
DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci)
Department of Computer Science, Sainik School Amaravathinagar
Cell No: 9431453730
Praveen M Jigajinni
Prepared by
Courtesy CBSE
Class XII
INTRODUCTION
INTRODUCTION
A Module is a file containing python definitions,
functions, variables, classes and statements with .py
extension.
Python package is a directory of python module.
A Library is a collection of various packages.
There is no difference between library and python
package. Library is used to loosely describe a
collection of core or main modules.
COMPONENTS OF PYTHON PROGRAM
COMPONENTS OF PYTHON PROGRAM
A Module is a file that contains python code.
The python program comprises of three main
components
i) Library or Package
ii) Module
iii) Functions/Sub-Modules
ADVANTAGES OF MODULES
ADVANTAGES OF MODULES
1. Reusability
2. Clarity
3. Classification/ Grouping of code
4. Easy to understand
IMPORTING MODULES
IMPORTING MODULES
t
Python module files have an extension .py
These modules can be imported in the following
ways:
1) import statement
2) from statement
3) from * statement
IMPORTING MODULES- import
t
import statement is used to include the modules
in other programs.
syntax : import <filename>
example: import math
more than one module can be
inserted in a python program
syntax : import <filename> ,<filename>,
<filename>……..
for example: import math,os
IMPORTING MODULES- import
t
using import statement one can view all the
functions and other attributes of a particular
module
for example: import math
dir(math)
IMPORTING MODULES- import
IMPORTING MODULES- from
t
importing module can be done using from
statement specific attributes can be included in
other programs.
syntax :
from <filename> import function name
example:
from math import math.sqrt
IMPORTING MODULES- from*
t
from* statement can be used to import all
names from the module in to the current calling
name space.
syntax :
from <filename> import *
example:
from math import *
math.sqrt(4)
we can access any function by using dot
notation.
NAMESPACES
NAMESPACES
t
When we import modules in a particular
program these modules will become part of that
program and are called as namespace.
Python impliments namespaces in the form of
dictionaries. It maintains a name to object mapping.
There are three types of namespaces
1) Global
2) Local
3) Built in
NAMESPACES
Built in name space
Global name space
Local name
space
NAME RESOLUTION
NAME RESOLUTION
t9lo
Already we know the scope rules of python
programming.
For every name reference within a
program when you access a variable python follows
name resolution rule i.e LEGB (Local, Enclosed,
Global, Built-in)
Contd.. Next slide
NAME RESOLUTION
Built in name space
Global name space
Local name space
Enclosed
MODULE ALIASING
MODULE ALIASING
t9lo
One can create an alias while importing module
in a program
syntax:
import <filename> as <alias name>
for example: import math as m
m.sqrt(4)
MEMBER ALIASING
MEMBER ALIASING
t9lo
Like module aliasing members are also aliased
syntax:
import <filename> as <alias name>,
member as alias name
for example: import test as t, add as sum
test.py is module file and is
referred to as t and add is the function, it is referred
to as sum.
PACKAGE/LIBRARY
PACKAGE/LIBRARY
t9lo
Python packages are the collection of related
modules. You can import a package or create your
own.
The main difference between a module
and a package is that package is a
collection of modules and has an
__init__.py file
PACKAGE/LIBRARY
t9lo
Python package is a simply directory of python
modules
Steps to create and import a package
1. create a directory named ‘Gemetry’
2. add modules area.py and volume.py
3. create a file __init__.py in directory
‘Geometry’. The __init__.py files are
required to make python treat the
directory as containing package
PACKAGE/LIBRARY
GEOMETRY
Area.py Volume.py
FOLDER
FILES
PACKAGE/LIBRARY
FOLDER IS CREATED
PACKAGE/LIBRARY
AREA MODULE IS CREATED
PACKAGE/LIBRARY
VOLUME MODULE IS CREATED
PACKAGE/LIBRARY
CREATING __init__.py FILE
PACKAGE/LIBRARY
__init__.py FILE
What is __init__.py file?
__init__.py is simply a file used to
consider directories on the disk as
package of python.
It is basically used to initilize the
python package
LOCATING MODULES
PACKAGE/LIBRARY
Python searches module in the
following manner
1) Searches in current directory
2) If the module is not found then
searches each directory in the shell
variable PYTHONPATH
3) If all else fails, python checks the
default path which is the installation
location of the python
PACKAGE/LIBRARY
Python searches module in the
following manner
1) Searches in current directory
2) If the module is not found then
searches each directory in the shell
variable PYTHONPATH
3) If all else fails, python checks the
default path which is the installation
location of the python
pip
What is pip?
pip is a package-management
system used to install and manage
software packages written in Python.
To check pip version run,
pip --version at dos prompt
PYTHON STANDARD LIBRARY
PYTHON STANDARD LIBRARY
DATE AND TIME MODULE.
import datetime
v_date=datetime.date.today()
vyear = v_date.year()
vmonth = v_date.month()
vday = v_date.day()
PYTHON STANDARD LIBRARY
DATE AND TIME MODULE.
import datetime
v_date=datetime.date.today()
vnow = v_date.now()
vhour = v_date.hour()
vmin = v_date.minute()
vsec = v_date.second()
CLASS TEST
1. What are the components of python program.
2.Explain the ways to import a module in
python program.
3.What is namespace? Explain in detail
4. What is python package? Write down the
steps to create a python package and also write
a programs and create a package.
Class : XII Time: 40 Min
Topic: Python Libraries Max Marks: 40
Each Question carries 5 Marks
Thank You
Ad

More Related Content

What's hot (20)

File handling in Python
File handling in PythonFile handling in Python
File handling in Python
Megha V
 
Python libraries
Python librariesPython libraries
Python libraries
Prof. Dr. K. Adisesha
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
Srinivas Narasegouda
 
Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programming
sambitmandal
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
TMARAGATHAM
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
RaginiJain21
 
Python Lambda Function
Python Lambda FunctionPython Lambda Function
Python Lambda Function
Md Soyaib
 
Python OOPs
Python OOPsPython OOPs
Python OOPs
Binay Kumar Ray
 
Variables in python
Variables in pythonVariables in python
Variables in python
Jaya Kumari
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
Devashish Kumar
 
Database connectivity in python
Database connectivity in pythonDatabase connectivity in python
Database connectivity in python
baabtra.com - No. 1 supplier of quality freshers
 
Python file handling
Python file handlingPython file handling
Python file handling
Prof. Dr. K. Adisesha
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Abhilash Nair
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
Devashish Kumar
 
Strings in python
Strings in pythonStrings in python
Strings in python
Prabhakaran V M
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
Akhil Kaushik
 
Python variables and data types.pptx
Python variables and data types.pptxPython variables and data types.pptx
Python variables and data types.pptx
AkshayAggarwal79
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in Python
PriyankaC44
 
Python Modules
Python ModulesPython Modules
Python Modules
Nitin Reddy Katkam
 

Similar to Chapter 03 python libraries (20)

Using Python Libraries.pdf
Using Python Libraries.pdfUsing Python Libraries.pdf
Using Python Libraries.pdf
SoumyadityaDey
 
Using python libraries.pptx , easy ppt to study class 12
Using python libraries.pptx , easy ppt to study class 12Using python libraries.pptx , easy ppt to study class 12
Using python libraries.pptx , easy ppt to study class 12
anikedheikhamsingh
 
Python modules
Python   modulesPython   modules
Python modules
Learnbay Datascience
 
Python Session - 5
Python Session - 5Python Session - 5
Python Session - 5
AnirudhaGaikwad4
 
packages.pptx
packages.pptxpackages.pptx
packages.pptx
SHAIKIRFAN715544
 
Python module 3, b.tech 5th semester ppt
Python module 3, b.tech 5th semester pptPython module 3, b.tech 5th semester ppt
Python module 3, b.tech 5th semester ppt
course5325
 
Python Modules, executing modules as script.pptx
Python Modules, executing modules as script.pptxPython Modules, executing modules as script.pptx
Python Modules, executing modules as script.pptx
Singamvineela
 
Pythonpresent
PythonpresentPythonpresent
Pythonpresent
Chui-Wen Chiu
 
Python. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdfPython. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdf
prasenjitghosh1998
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
Praveen M Jigajinni
 
Python modules
Python modulesPython modules
Python modules
Smt. Indira Gandhi College of Engineering, Navi Mumbai, Mumbai
 
Python modules
Python modulesPython modules
Python modules
Shanmugapriya Dineshbabu
 
Modules,Packages,Librarfrserrrrrrrrrrrries.pptx
Modules,Packages,Librarfrserrrrrrrrrrrries.pptxModules,Packages,Librarfrserrrrrrrrrrrries.pptx
Modules,Packages,Librarfrserrrrrrrrrrrries.pptx
CatherineBenban2
 
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp dmod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
paurushsinhad
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
gokul174578
 
Modules and Packages in Python_Basics.pdf
Modules and Packages in Python_Basics.pdfModules and Packages in Python_Basics.pdf
Modules and Packages in Python_Basics.pdf
RavindraTambe3
 
jb_Modules_in_Python.ppt
jb_Modules_in_Python.pptjb_Modules_in_Python.ppt
jb_Modules_in_Python.ppt
loliktry
 
python_models_import_main_init_presentation.ppt
python_models_import_main_init_presentation.pptpython_models_import_main_init_presentation.ppt
python_models_import_main_init_presentation.ppt
gouthamsaisurya555
 
Using Python Libraries.pdf
Using Python Libraries.pdfUsing Python Libraries.pdf
Using Python Libraries.pdf
SoumyadityaDey
 
Using python libraries.pptx , easy ppt to study class 12
Using python libraries.pptx , easy ppt to study class 12Using python libraries.pptx , easy ppt to study class 12
Using python libraries.pptx , easy ppt to study class 12
anikedheikhamsingh
 
Python module 3, b.tech 5th semester ppt
Python module 3, b.tech 5th semester pptPython module 3, b.tech 5th semester ppt
Python module 3, b.tech 5th semester ppt
course5325
 
Python Modules, executing modules as script.pptx
Python Modules, executing modules as script.pptxPython Modules, executing modules as script.pptx
Python Modules, executing modules as script.pptx
Singamvineela
 
Python. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdfPython. libraries. modules. and. all.pdf
Python. libraries. modules. and. all.pdf
prasenjitghosh1998
 
Modules,Packages,Librarfrserrrrrrrrrrrries.pptx
Modules,Packages,Librarfrserrrrrrrrrrrries.pptxModules,Packages,Librarfrserrrrrrrrrrrries.pptx
Modules,Packages,Librarfrserrrrrrrrrrrries.pptx
CatherineBenban2
 
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp dmod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
mod.ppt mod.ppt mod.ppt mod.ppt mod.pp d
paurushsinhad
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
Object oriented programming design and implementation
Object oriented programming design and implementationObject oriented programming design and implementation
Object oriented programming design and implementation
afsheenfaiq2
 
python interview prep question , 52 questions
python interview prep question , 52 questionspython interview prep question , 52 questions
python interview prep question , 52 questions
gokul174578
 
Modules and Packages in Python_Basics.pdf
Modules and Packages in Python_Basics.pdfModules and Packages in Python_Basics.pdf
Modules and Packages in Python_Basics.pdf
RavindraTambe3
 
jb_Modules_in_Python.ppt
jb_Modules_in_Python.pptjb_Modules_in_Python.ppt
jb_Modules_in_Python.ppt
loliktry
 
python_models_import_main_init_presentation.ppt
python_models_import_main_init_presentation.pptpython_models_import_main_init_presentation.ppt
python_models_import_main_init_presentation.ppt
gouthamsaisurya555
 
Ad

More from Praveen M Jigajinni (20)

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
Praveen M Jigajinni
 
Chapter 08 data file handling
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handling
Praveen M Jigajinni
 
Chapter 07 inheritance
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritance
Praveen M Jigajinni
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
Praveen M Jigajinni
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
Praveen M Jigajinni
 
Chapter 17 Tuples
Chapter 17 TuplesChapter 17 Tuples
Chapter 17 Tuples
Praveen M Jigajinni
 
Chapter 14 strings
Chapter 14 stringsChapter 14 strings
Chapter 14 strings
Praveen M Jigajinni
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handling
Praveen M Jigajinni
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
Praveen M Jigajinni
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
Praveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
Praveen M Jigajinni
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
Praveen M Jigajinni
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
Chapter 5 boolean algebra
Chapter 5 boolean algebraChapter 5 boolean algebra
Chapter 5 boolean algebra
Praveen M Jigajinni
 
Chapter 4 number system
Chapter 4 number systemChapter 4 number system
Chapter 4 number system
Praveen M Jigajinni
 
Chapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computingChapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computing
Praveen M Jigajinni
 
Chapter 2 operating systems
Chapter 2 operating systemsChapter 2 operating systems
Chapter 2 operating systems
Praveen M Jigajinni
 
Chapter 1 computer fundamentals
Chapter 1 computer  fundamentalsChapter 1 computer  fundamentals
Chapter 1 computer fundamentals
Praveen M Jigajinni
 
Chapter 0 syllabus 2019 20
Chapter 0  syllabus 2019 20Chapter 0  syllabus 2019 20
Chapter 0 syllabus 2019 20
Praveen M Jigajinni
 
Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
Praveen M Jigajinni
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
Praveen M Jigajinni
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
Praveen M Jigajinni
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
Praveen M Jigajinni
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
Praveen M Jigajinni
 
Chapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computingChapter 3 cloud computing and intro parrallel computing
Chapter 3 cloud computing and intro parrallel computing
Praveen M Jigajinni
 
Ad

Recently uploaded (20)

History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Ancient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian HistoryAncient Stone Sculptures of India: As a Source of Indian History
Ancient Stone Sculptures of India: As a Source of Indian History
Virag Sontakke
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
PHYSIOLOGY MCQS By DR. NASIR MUSTAFA (PHYSIOLOGY)
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 

Chapter 03 python libraries

  • 2. Unit I Programming and Computational Thinking (PCT-2) (80 Theory + 70 Practical) DCSc & Engg, PGDCA,ADCA,MCA.MSc(IT),Mtech(IT),MPhil (Comp. Sci) Department of Computer Science, Sainik School Amaravathinagar Cell No: 9431453730 Praveen M Jigajinni Prepared by Courtesy CBSE Class XII
  • 4. INTRODUCTION A Module is a file containing python definitions, functions, variables, classes and statements with .py extension. Python package is a directory of python module. A Library is a collection of various packages. There is no difference between library and python package. Library is used to loosely describe a collection of core or main modules.
  • 6. COMPONENTS OF PYTHON PROGRAM A Module is a file that contains python code. The python program comprises of three main components i) Library or Package ii) Module iii) Functions/Sub-Modules
  • 8. ADVANTAGES OF MODULES 1. Reusability 2. Clarity 3. Classification/ Grouping of code 4. Easy to understand
  • 10. IMPORTING MODULES t Python module files have an extension .py These modules can be imported in the following ways: 1) import statement 2) from statement 3) from * statement
  • 11. IMPORTING MODULES- import t import statement is used to include the modules in other programs. syntax : import <filename> example: import math more than one module can be inserted in a python program syntax : import <filename> ,<filename>, <filename>…….. for example: import math,os
  • 12. IMPORTING MODULES- import t using import statement one can view all the functions and other attributes of a particular module for example: import math dir(math)
  • 14. IMPORTING MODULES- from t importing module can be done using from statement specific attributes can be included in other programs. syntax : from <filename> import function name example: from math import math.sqrt
  • 15. IMPORTING MODULES- from* t from* statement can be used to import all names from the module in to the current calling name space. syntax : from <filename> import * example: from math import * math.sqrt(4) we can access any function by using dot notation.
  • 17. NAMESPACES t When we import modules in a particular program these modules will become part of that program and are called as namespace. Python impliments namespaces in the form of dictionaries. It maintains a name to object mapping. There are three types of namespaces 1) Global 2) Local 3) Built in
  • 18. NAMESPACES Built in name space Global name space Local name space
  • 20. NAME RESOLUTION t9lo Already we know the scope rules of python programming. For every name reference within a program when you access a variable python follows name resolution rule i.e LEGB (Local, Enclosed, Global, Built-in) Contd.. Next slide
  • 21. NAME RESOLUTION Built in name space Global name space Local name space Enclosed
  • 23. MODULE ALIASING t9lo One can create an alias while importing module in a program syntax: import <filename> as <alias name> for example: import math as m m.sqrt(4)
  • 25. MEMBER ALIASING t9lo Like module aliasing members are also aliased syntax: import <filename> as <alias name>, member as alias name for example: import test as t, add as sum test.py is module file and is referred to as t and add is the function, it is referred to as sum.
  • 27. PACKAGE/LIBRARY t9lo Python packages are the collection of related modules. You can import a package or create your own. The main difference between a module and a package is that package is a collection of modules and has an __init__.py file
  • 28. PACKAGE/LIBRARY t9lo Python package is a simply directory of python modules Steps to create and import a package 1. create a directory named ‘Gemetry’ 2. add modules area.py and volume.py 3. create a file __init__.py in directory ‘Geometry’. The __init__.py files are required to make python treat the directory as containing package
  • 34. PACKAGE/LIBRARY __init__.py FILE What is __init__.py file? __init__.py is simply a file used to consider directories on the disk as package of python. It is basically used to initilize the python package
  • 36. PACKAGE/LIBRARY Python searches module in the following manner 1) Searches in current directory 2) If the module is not found then searches each directory in the shell variable PYTHONPATH 3) If all else fails, python checks the default path which is the installation location of the python
  • 37. PACKAGE/LIBRARY Python searches module in the following manner 1) Searches in current directory 2) If the module is not found then searches each directory in the shell variable PYTHONPATH 3) If all else fails, python checks the default path which is the installation location of the python
  • 38. pip
  • 39. What is pip? pip is a package-management system used to install and manage software packages written in Python. To check pip version run, pip --version at dos prompt
  • 41. PYTHON STANDARD LIBRARY DATE AND TIME MODULE. import datetime v_date=datetime.date.today() vyear = v_date.year() vmonth = v_date.month() vday = v_date.day()
  • 42. PYTHON STANDARD LIBRARY DATE AND TIME MODULE. import datetime v_date=datetime.date.today() vnow = v_date.now() vhour = v_date.hour() vmin = v_date.minute() vsec = v_date.second()
  • 43. CLASS TEST 1. What are the components of python program. 2.Explain the ways to import a module in python program. 3.What is namespace? Explain in detail 4. What is python package? Write down the steps to create a python package and also write a programs and create a package. Class : XII Time: 40 Min Topic: Python Libraries Max Marks: 40 Each Question carries 5 Marks
  翻译: