SlideShare a Scribd company logo
Brief Tour of the Standard Library
Matching patterns
Definition Program
 Regular expressions are
complicated mini-language. They
rely on special characters to
match unknown strings, but let's
start with literal characters, such
as letters, numbers, and the space
character, which always match
themselves.
 The “re” module which comes
with every python installation
provides regular expression
support.
import re
search_string = "Techno Plus Logic"
pattern = "Tec"
match = re.match(pattern,
search_string)
if match:
print("Pattern Found ",
match.group())
else:
Math functions
Definition Program
 Python has a math module that
provides most of the familiar
mathematical functions. A
module is a file that contains a
collection of related functions.
 Before we can use the module,
we have to import it:
 >>> import math
 print(math.sin(45))
 print(math.tan(45))
 print(math.cos(45))
 print(math.log10(45))
 print(math.sqrt(4))
 print(math.ceil(4.55565))
 print(math.degrees(45))
 print(math.pow(4,5))
Internet Access
Definition
Checking Internet Connection in
Python
 Nowadays, the Internet is an
essential part of our day-to-day
lives. If the server is down even for
a minute, then we check the Internet
connectivity in various ways. Can
Python help us check the
connectivity? Yes, we can use
Python language for checking the
internet connection. In this tutorial,
we will find out whether the
computer is connected to the internet
or not.
1. using urllib package.
2. using an IP address/socket
package.
Date & Time:
Definition
The types of objects in datetime are
as below.
 In python, datetime is a module
which provides different classes
to work with dates and times.
 date
 time
 datetime
 timedelta
 tzinfo
 timezone
Date Object: Pragram
 Date object depicts the date as
date(year, month, day) in an ideal
Gregorian calendar. Syntax of the
Date class is represented as
below.
 Syntax:
 class
datetime.date(year,month,day)
>>> from datetime import date
# method today() shows the today's date
>>> today=date.today()
>>> today
datetime.date(2017, 11, 7)
>>> x=d.timetuple()
>>> today=x
>>> x
time.struct_time(tm_year=2017, tm_mon=8,
tm_mday=15, tm_hour=0, tm_min=0, tm_sec=0,
tm_wday=1, tm_yday=227, tm_isdst=-1)
# assigning the date
>>> d=date(2017,11,7)
Multithreading
Concept Definition
 In computing, a process is an
instance of a computer program that
is being executed. Any process has 3
basic components:
 An executable program.
 The associated data needed by the
program (variables, work space,
buffers, etc.).
 The execution context of the
program (State of process).
 A thread is an entity within a process
that can be scheduled for execution.
Also, it is the smallest unit of
processing that can be performed in an
OS (Operating System).
 In simple words, a thread is a sequence
of such instructions within a program
that can be executed independently of
other code. For simplicity, you can
assume that a thread is simply a subset
of a process!
A thread contains all this information in a Thread
Control Block (TCB):
 Thread Identifier: Unique id (TID) is assigned to every new thread
Stack pointer: Points to thread’s stack in the process. Stack contains the
local variables under thread’s scope.
Program counter: a register which stores the address of the instruction
currently being executed by thread.
Thread state: can be running, ready, waiting, start or done.
Thread’s register set: registers assigned to thread for computations.
Parent process Pointer: A pointer to the Process control block (PCB) of
the process that the thread lives on.
Data compression
Definition Program
 Data compression is the process of
modifying, encoding or converting
the bits structure of data in such a
way that it consumes less space on
disk. It enables reducing the storage
size of one or more data instances or
elements. Data compression is also
known as source coding or bit-rate
reduction.
 Zip is the build-in.
 >>> import zlib
 >>> s = b'you learn learnt learning
the data daily '
 >>>len(s)
 41
 >>>
 >>> t = zlib.compress(s)
 >>>len(t)
 39
GUI Interface
Definition
 Tkinter is the standard GUI
library for Python. Python when
combined with Tkinter provides a
fast and easy way to create GUI
applications. Tkinter provides a
powerful object-oriented interface
to the Tk GUI toolkit.
 Import Tkinter in program.
Sr.No. Operator
1
Button
2
Canvas
3
Checkbutton
4
Entry
5
Frame
6
Label
7
Listbox
8
Menubutton
9
Menu
10
Message
Turtle Programming
Definition
 “Turtle” is a Python feature like a
drawing board, which lets us
command a turtle to draw all over
it! We can use functions like
turtle.forward(…) and
turtle.right(…) which can move
the turtle around. Commonly
used turtle methods are.
 Import turtle in program.
METHOD
Turtle()
forward()
backward()
right()
left()
penup()
pendown()
up()
down()
color()
Program
Testing
Definition
Unit Test
 Testing determines whether
software runs correctly based on
specific inputs and identifies
defects that need to be fixed.
 Unit Testing in Python is done to
identify bugs early in the
development stage of the
application when bugs are less
recurrent and less expensive to
fix. A unit test is a scripted code
level test designed in Python to
verify a small "unit" of
functionality.
Why is testing important?
 As software scales in codebase size, it's impossible for a person or even a large team to
keep up with all of the changes and the interactions between the changes. Automated
testing is the only proven method for building reliable software once they grow past the
point of a simple prototype. Many major software program development failures can be
traced back to inadequate or a complete lack of testing.
 It's impossible to know whether software works properly unless it is tested. While
testing can be done manually, by a user clicking buttons or typing in input, it should be
performed automatically by writing software programs that test the application under
test.
 There are many forms of testing and they should all be used together. When a single
function of a program is isolated for testing, that is called unit testing. Testing more than
a single function in an application at the same time is known as integration testing. User
interface testing ensures the correctness of how a user would interact with the software.
There are even more forms of testing that large programs need, such as load
testing, database testing, and browser testing (for web applications).
Writing and Running Test case
 Create a file named tests.py in the folder named “tests”.
 In tests.py import unittest.
 Create a class named TestClass which inherits from the class unittest.
TestCase.
 Create a test method
 To run the tests, we just defined, we need to call the method unittest.
Ad

More Related Content

What's hot (20)

Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Edureka!
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
AnitaDevi158873
 
Python dictionary
Python dictionaryPython dictionary
Python dictionary
Sagar Kumar
 
Quicksort Presentation
Quicksort PresentationQuicksort Presentation
Quicksort Presentation
irdginfo
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
Trupti Agrawal
 
Learn Python The Hard Way Presentation
Learn Python The Hard Way PresentationLearn Python The Hard Way Presentation
Learn Python The Hard Way Presentation
Amira ElSharkawy
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
Lemia Algmri
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
Flynce Miguel
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in java
Rakesh Mittal
 
Features of Python.pdf
Features of Python.pdfFeatures of Python.pdf
Features of Python.pdf
SudhanshiBakre1
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
 
Recursion
RecursionRecursion
Recursion
Jesmin Akhter
 
Generators In Python
Generators In PythonGenerators In Python
Generators In Python
Simplilearn
 
Data structure tries
Data structure triesData structure tries
Data structure tries
Md. Naim khan
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular Expressions
Ranel Padon
 
Heapify algorithm
Heapify algorithmHeapify algorithm
Heapify algorithm
Sikandar Pandit
 
Non- Deterministic Algorithms
Non- Deterministic AlgorithmsNon- Deterministic Algorithms
Non- Deterministic Algorithms
Dipankar Boruah
 
Hamiltonian path
Hamiltonian pathHamiltonian path
Hamiltonian path
Arindam Ghosh
 
Python strings
Python stringsPython strings
Python strings
Mohammed Sikander
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
Ruchika Sinha
 
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Java Strings Tutorial | String Manipulation in Java | Java Tutorial For Begin...
Edureka!
 
Python dictionary
Python dictionaryPython dictionary
Python dictionary
Sagar Kumar
 
Quicksort Presentation
Quicksort PresentationQuicksort Presentation
Quicksort Presentation
irdginfo
 
Learn Python The Hard Way Presentation
Learn Python The Hard Way PresentationLearn Python The Hard Way Presentation
Learn Python The Hard Way Presentation
Amira ElSharkawy
 
heap Sort Algorithm
heap  Sort Algorithmheap  Sort Algorithm
heap Sort Algorithm
Lemia Algmri
 
Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)Analysis of Algorithm (Bubblesort and Quicksort)
Analysis of Algorithm (Bubblesort and Quicksort)
Flynce Miguel
 
Thread priority in java
Thread priority in javaThread priority in java
Thread priority in java
Rakesh Mittal
 
Types of Statements in Python Programming Language
Types of Statements in Python Programming LanguageTypes of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
 
Generators In Python
Generators In PythonGenerators In Python
Generators In Python
Simplilearn
 
Data structure tries
Data structure triesData structure tries
Data structure tries
Md. Naim khan
 
Python Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular ExpressionsPython Programming - XI. String Manipulation and Regular Expressions
Python Programming - XI. String Manipulation and Regular Expressions
Ranel Padon
 
Non- Deterministic Algorithms
Non- Deterministic AlgorithmsNon- Deterministic Algorithms
Non- Deterministic Algorithms
Dipankar Boruah
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
Ruchika Sinha
 

Similar to Standard Libraries in Python Programming (20)

pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docx
RameshMishra84
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
RaginiJain21
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
acijjournal
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Make Mannan
 
libraries in python using different .pptx
libraries in python using different .pptxlibraries in python using different .pptx
libraries in python using different .pptx
urvashipundir04
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine Learning
Student
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
FabMinds
 
Lec1
Lec1Lec1
Lec1
Ibrahim El-Torbany
 
Lec1
Lec1Lec1
Lec1
Saad Gabr
 
object oriented programming language in c++
object oriented programming language in c++object oriented programming language in c++
object oriented programming language in c++
Ravikant517175
 
Python Training on python and SQL PPT.pptx
Python Training on python and SQL PPT.pptxPython Training on python and SQL PPT.pptx
Python Training on python and SQL PPT.pptx
xelihom699
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
Aarti P
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
MalarMohana
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
sujathavvv
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
muhammadRamzan816406
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
TEJVEER SINGH
 
The Evolution Of Eclipse 1. 1 )
The Evolution Of Eclipse 1. 1 )The Evolution Of Eclipse 1. 1 )
The Evolution Of Eclipse 1. 1 )
Patty Buckley
 
ArduinoWorkshop2.pdf
ArduinoWorkshop2.pdfArduinoWorkshop2.pdf
ArduinoWorkshop2.pdf
PedramKashiani
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
pythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docxpythonlibrariesandmodules-210530042906.docx
pythonlibrariesandmodules-210530042906.docx
RameshMishra84
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
RaginiJain21
 
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
AUTOCODECOVERGEN: PROTOTYPE OF DATA DRIVEN UNIT TEST GENRATION TOOL THAT GUAR...
acijjournal
 
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org)  (usef...
Lab manual object oriented technology (it 303 rgpv) (usefulsearch.org) (usef...
Make Mannan
 
libraries in python using different .pptx
libraries in python using different .pptxlibraries in python using different .pptx
libraries in python using different .pptx
urvashipundir04
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine Learning
Student
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
FabMinds
 
object oriented programming language in c++
object oriented programming language in c++object oriented programming language in c++
object oriented programming language in c++
Ravikant517175
 
Python Training on python and SQL PPT.pptx
Python Training on python and SQL PPT.pptxPython Training on python and SQL PPT.pptx
Python Training on python and SQL PPT.pptx
xelihom699
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
Aarti P
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
MalarMohana
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
sujathavvv
 
Automation Testing theory notes.pptx
Automation Testing theory notes.pptxAutomation Testing theory notes.pptx
Automation Testing theory notes.pptx
NileshBorkar12
 
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...HOW TO DOWNLOAD MICROSOFT WORD  IN ANDROID, and How to convert doc file into ...
HOW TO DOWNLOAD MICROSOFT WORD IN ANDROID, and How to convert doc file into ...
TEJVEER SINGH
 
The Evolution Of Eclipse 1. 1 )
The Evolution Of Eclipse 1. 1 )The Evolution Of Eclipse 1. 1 )
The Evolution Of Eclipse 1. 1 )
Patty Buckley
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
Dozie Agbo
 
Ad

Recently uploaded (20)

Resistance measurement and cfd test on darpa subboff model
Resistance measurement and cfd test on darpa subboff modelResistance measurement and cfd test on darpa subboff model
Resistance measurement and cfd test on darpa subboff model
INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdfMAQUINARIA MINAS CEMA 6th Edition (1).pdf
MAQUINARIA MINAS CEMA 6th Edition (1).pdf
ssuser562df4
 
Artificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptxArtificial Intelligence introduction.pptx
Artificial Intelligence introduction.pptx
DrMarwaElsherif
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
DSP and MV the Color image processing.ppt
DSP and MV the  Color image processing.pptDSP and MV the  Color image processing.ppt
DSP and MV the Color image processing.ppt
HafizAhamed8
 
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design ThinkingDT REPORT by Tech titan GROUP to introduce the subject design Thinking
DT REPORT by Tech titan GROUP to introduce the subject design Thinking
DhruvChotaliya2
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIHlecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
lecture5.pptxJHKGJFHDGTFGYIUOIUIPIOIPUOHIYGUYFGIH
Abodahab
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Data Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptxData Structures_Linear data structures Linked Lists.pptx
Data Structures_Linear data structures Linked Lists.pptx
RushaliDeshmukh2
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Ad

Standard Libraries in Python Programming

  • 1. Brief Tour of the Standard Library
  • 2. Matching patterns Definition Program  Regular expressions are complicated mini-language. They rely on special characters to match unknown strings, but let's start with literal characters, such as letters, numbers, and the space character, which always match themselves.  The “re” module which comes with every python installation provides regular expression support. import re search_string = "Techno Plus Logic" pattern = "Tec" match = re.match(pattern, search_string) if match: print("Pattern Found ", match.group()) else:
  • 3. Math functions Definition Program  Python has a math module that provides most of the familiar mathematical functions. A module is a file that contains a collection of related functions.  Before we can use the module, we have to import it:  >>> import math  print(math.sin(45))  print(math.tan(45))  print(math.cos(45))  print(math.log10(45))  print(math.sqrt(4))  print(math.ceil(4.55565))  print(math.degrees(45))  print(math.pow(4,5))
  • 4. Internet Access Definition Checking Internet Connection in Python  Nowadays, the Internet is an essential part of our day-to-day lives. If the server is down even for a minute, then we check the Internet connectivity in various ways. Can Python help us check the connectivity? Yes, we can use Python language for checking the internet connection. In this tutorial, we will find out whether the computer is connected to the internet or not. 1. using urllib package. 2. using an IP address/socket package.
  • 5. Date & Time: Definition The types of objects in datetime are as below.  In python, datetime is a module which provides different classes to work with dates and times.  date  time  datetime  timedelta  tzinfo  timezone
  • 6. Date Object: Pragram  Date object depicts the date as date(year, month, day) in an ideal Gregorian calendar. Syntax of the Date class is represented as below.  Syntax:  class datetime.date(year,month,day) >>> from datetime import date # method today() shows the today's date >>> today=date.today() >>> today datetime.date(2017, 11, 7) >>> x=d.timetuple() >>> today=x >>> x time.struct_time(tm_year=2017, tm_mon=8, tm_mday=15, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=1, tm_yday=227, tm_isdst=-1) # assigning the date >>> d=date(2017,11,7)
  • 7. Multithreading Concept Definition  In computing, a process is an instance of a computer program that is being executed. Any process has 3 basic components:  An executable program.  The associated data needed by the program (variables, work space, buffers, etc.).  The execution context of the program (State of process).  A thread is an entity within a process that can be scheduled for execution. Also, it is the smallest unit of processing that can be performed in an OS (Operating System).  In simple words, a thread is a sequence of such instructions within a program that can be executed independently of other code. For simplicity, you can assume that a thread is simply a subset of a process!
  • 8. A thread contains all this information in a Thread Control Block (TCB):  Thread Identifier: Unique id (TID) is assigned to every new thread Stack pointer: Points to thread’s stack in the process. Stack contains the local variables under thread’s scope. Program counter: a register which stores the address of the instruction currently being executed by thread. Thread state: can be running, ready, waiting, start or done. Thread’s register set: registers assigned to thread for computations. Parent process Pointer: A pointer to the Process control block (PCB) of the process that the thread lives on.
  • 9. Data compression Definition Program  Data compression is the process of modifying, encoding or converting the bits structure of data in such a way that it consumes less space on disk. It enables reducing the storage size of one or more data instances or elements. Data compression is also known as source coding or bit-rate reduction.  Zip is the build-in.  >>> import zlib  >>> s = b'you learn learnt learning the data daily '  >>>len(s)  41  >>>  >>> t = zlib.compress(s)  >>>len(t)  39
  • 10. GUI Interface Definition  Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit.  Import Tkinter in program. Sr.No. Operator 1 Button 2 Canvas 3 Checkbutton 4 Entry 5 Frame 6 Label 7 Listbox 8 Menubutton 9 Menu 10 Message
  • 11. Turtle Programming Definition  “Turtle” is a Python feature like a drawing board, which lets us command a turtle to draw all over it! We can use functions like turtle.forward(…) and turtle.right(…) which can move the turtle around. Commonly used turtle methods are.  Import turtle in program. METHOD Turtle() forward() backward() right() left() penup() pendown() up() down() color()
  • 13. Testing Definition Unit Test  Testing determines whether software runs correctly based on specific inputs and identifies defects that need to be fixed.  Unit Testing in Python is done to identify bugs early in the development stage of the application when bugs are less recurrent and less expensive to fix. A unit test is a scripted code level test designed in Python to verify a small "unit" of functionality.
  • 14. Why is testing important?  As software scales in codebase size, it's impossible for a person or even a large team to keep up with all of the changes and the interactions between the changes. Automated testing is the only proven method for building reliable software once they grow past the point of a simple prototype. Many major software program development failures can be traced back to inadequate or a complete lack of testing.  It's impossible to know whether software works properly unless it is tested. While testing can be done manually, by a user clicking buttons or typing in input, it should be performed automatically by writing software programs that test the application under test.  There are many forms of testing and they should all be used together. When a single function of a program is isolated for testing, that is called unit testing. Testing more than a single function in an application at the same time is known as integration testing. User interface testing ensures the correctness of how a user would interact with the software. There are even more forms of testing that large programs need, such as load testing, database testing, and browser testing (for web applications).
  • 15. Writing and Running Test case  Create a file named tests.py in the folder named “tests”.  In tests.py import unittest.  Create a class named TestClass which inherits from the class unittest. TestCase.  Create a test method  To run the tests, we just defined, we need to call the method unittest.