SlideShare a Scribd company logo
Introduction to 
Programming with 
Python – Class 3 
SYED FARJAD ZIA ZAIDI
Class Objectives 
Class Objective 
Understanding Strings and some useful string operations. 
Write few simple programs that use string functions and lists.
Class Material 
•Chapter 6, 8 - 
Python for 
Informatics: 
Exploring 
Information 
Reading
Strings 
 Strings are amongst the most popular types in 
Python. We can create them simply by 
enclosing characters in quotes. Python treats 
single quotes the same as double quotes. 
 Creating strings is as simple as assigning a value 
to a variable. For example: 
message = “Hello World”
Introduction to Indexing 
 Strings can be divided into substrings using indexing. 
 To access substrings, use the square brackets for slicing along with 
the index or indices to obtain your substring, this is called Indexing. 
Following is a simple example: 
message = 'Hello World!' 
messageTwo = "Python Programming" 
print "var1[0]: ", message[0] 
print "var2[1:5]: ", messageTwo[1:5]
String Concatenation 
 String concatenation is a process in which two strings are merged 
together. Concatenation is very simple and uses the operator ‘+’ to 
concatenate. 
For Example: 
message = “Hello” 
messageTwo = “ “ 
messageThree = “World” 
print message + messageTwo + messageThree
Escape Characters 
 Following table is a list of commonly used escape or non-printable 
characters that can be represented with backslash notation. 
An escape character gets interpreted; in a single quoted as well as 
double quoted strings. 
Backslash Notation Description 
n New Line 
t Space 
s Tab
String Special Operators 
+ 
•Concatenation - 
Adds values on 
either side of the 
operator 
* 
•Repetition - 
Creates new 
strings, 
concatenating 
multiple copies of 
the same string
Python Comparison Operators 
[] 
• Slice - Gives the character from the given index 
[ : ] 
•Range Slice - Gives the characters from the 
given range
Python Comparison Operators 
in 
• Membership - Returns true if a character 
exists in the given string 
not in 
• Membership - Returns true if a character 
does not exist in the given string
Python Triple Quotes 
 Python's triple quotes comes to the rescue by allowing strings to 
span multiple lines, including verbatim NEWLINEs, TABs, and any 
other special characters.
String Functions: 
Method Description 
capitalize() Capitalizes first letter of string 
count(str, beg=0, end=len(string)) Counts how many times str occurs in 
string or in a substring of string if 
starting index beg and ending index 
end are given 
find(str, beg=0, end=len(string)) Determine if str occurs in string or in a 
substring of string if starting index beg 
and ending index end are given 
returns index if found and -1 otherwise 
index(str, beg=0, end=len(string)) Same as find(), but raises an error if str 
not found 
len(string) Returns the length of the string
String Functions: 
 Go to the following link for more string functions: 
http://www.tutorialspoint.com/python/python_strings.htm 
 You can also find string functions by writing the following in the 
python IDLE 
help(str)
Exercise 1 
 Write code using find() and string slicing to extract the number at 
the end of the line below. Convert the extracted value to a floating 
point number and print it out. 
text = "X-DSPAM-Confidence: 0.8475";
Exercise 2 
 Given a string and a non-negative int n, return a larger string that is n 
copies of the original string. 
string_times('Hi', 2) → 'HiHi' 
string_times('Hi', 3) → 'HiHiHi' 
string_times('Hi', 1) → 'Hi'
Exercise 3 
 Given a string, return a string where for every char in the original, there 
are two chars. 
double_char('The') → 'TThhee' 
double_char('AAbb') → 'AAAAbbbb' 
double_char('Hi-There') → 'HHii--TThheerree'
Any Queries? 
 Link to Facebook Group: 
https://www.facebook.com/groups/introtopython.iccbs/ 
 Email: 
farjad_bullet@rocketmail.com

More Related Content

What's hot (19)

Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
Praveen M Jigajinni
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
Rasan Samarasinghe
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
Mohd Sajjad
 
Python revision tour II
Python revision tour IIPython revision tour II
Python revision tour II
Mr. Vikram Singh Slathia
 
Lesson 03 python statement, indentation and comments
Lesson 03   python statement, indentation and commentsLesson 03   python statement, indentation and comments
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
MansiSuthar3
 
Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
srinivasanr281952
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Python
PythonPython
Python
Rural Engineering College Hulkoti
 
Python Data Types
Python Data TypesPython Data Types
Python Data Types
athithanvijay
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
Haitham El-Ghareeb
 
Data types in python
Data types in pythonData types in python
Data types in python
Learnbay Datascience
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
Devashish Kumar
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
Jothi Thilaga P
 
Python basics
Python basicsPython basics
Python basics
Manisha Gholve
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
Mohd Sajjad
 
Lesson 03 python statement, indentation and comments
Lesson 03   python statement, indentation and commentsLesson 03   python statement, indentation and comments
Lesson 03 python statement, indentation and comments
Nilimesh Halder
 
Introduction to Python programming Language
Introduction to Python programming LanguageIntroduction to Python programming Language
Introduction to Python programming Language
MansiSuthar3
 
Lesson 02 python keywords and identifiers
Lesson 02   python keywords and identifiersLesson 02   python keywords and identifiers
Lesson 02 python keywords and identifiers
Nilimesh Halder
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
amiable_indian
 
Fundamentals of Python Programming
Fundamentals of Python ProgrammingFundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
 
Introduction to Python Part-1
Introduction to Python Part-1Introduction to Python Part-1
Introduction to Python Part-1
Devashish Kumar
 
Values and Data types in python
Values and Data types in pythonValues and Data types in python
Values and Data types in python
Jothi Thilaga P
 

Viewers also liked (20)

Substituting HDF5 tools with Python/H5py scripts
Substituting HDF5 tools with Python/H5py scriptsSubstituting HDF5 tools with Python/H5py scripts
Substituting HDF5 tools with Python/H5py scripts
The HDF-EOS Tools and Information Center
 
Logic Over Language
Logic Over LanguageLogic Over Language
Logic Over Language
Purple, Rock, Scissors
 
Python and HDF5: Overview
Python and HDF5: OverviewPython and HDF5: Overview
Python and HDF5: Overview
andrewcollette
 
Introduction To Programming with Python-5
Introduction To Programming with Python-5Introduction To Programming with Python-5
Introduction To Programming with Python-5
Syed Farjad Zia Zaidi
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
Syed Farjad Zia Zaidi
 
An Introduction to Interactive Programming in Python 2013
An Introduction to Interactive Programming in Python 2013An Introduction to Interactive Programming in Python 2013
An Introduction to Interactive Programming in Python 2013
Syed Farjad Zia Zaidi
 
Logic: Language and Information 1
Logic: Language and Information 1Logic: Language and Information 1
Logic: Language and Information 1
Syed Farjad Zia Zaidi
 
Introduction to UBI
Introduction to UBIIntroduction to UBI
Introduction to UBI
Roy Lee
 
Python 4 Arc
Python 4 ArcPython 4 Arc
Python 4 Arc
absvis
 
The Python Programming Language and HDF5: H5Py
The Python Programming Language and HDF5: H5PyThe Python Programming Language and HDF5: H5Py
The Python Programming Language and HDF5: H5Py
The HDF-EOS Tools and Information Center
 
Clase 2 estatica
Clase 2 estatica Clase 2 estatica
Clase 2 estatica
Gerald Moreira Ramírez
 
Using HDF5 and Python: The H5py module
Using HDF5 and Python: The H5py moduleUsing HDF5 and Python: The H5py module
Using HDF5 and Python: The H5py module
The HDF-EOS Tools and Information Center
 
HDF5 Tools
HDF5 ToolsHDF5 Tools
HDF5 Tools
The HDF-EOS Tools and Information Center
 
Python programming - Everyday(ish) Examples
Python programming - Everyday(ish) ExamplesPython programming - Everyday(ish) Examples
Python programming - Everyday(ish) Examples
Ashish Sharma
 
Lets learn Python !
Lets learn Python !Lets learn Python !
Lets learn Python !
Kiran Gangadharan
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
Syed Farjad Zia Zaidi
 
Cyberoam Firewall Presentation
Cyberoam Firewall PresentationCyberoam Firewall Presentation
Cyberoam Firewall Presentation
Manoj Kumar Mishra
 
introduction to python
introduction to pythonintroduction to python
introduction to python
Sardar Alam
 
流程語法與函式
流程語法與函式流程語法與函式
流程語法與函式
Justin Lin
 
進階主題
進階主題進階主題
進階主題
Justin Lin
 
Python and HDF5: Overview
Python and HDF5: OverviewPython and HDF5: Overview
Python and HDF5: Overview
andrewcollette
 
Introduction To Programming with Python-5
Introduction To Programming with Python-5Introduction To Programming with Python-5
Introduction To Programming with Python-5
Syed Farjad Zia Zaidi
 
An Introduction to Interactive Programming in Python 2013
An Introduction to Interactive Programming in Python 2013An Introduction to Interactive Programming in Python 2013
An Introduction to Interactive Programming in Python 2013
Syed Farjad Zia Zaidi
 
Introduction to UBI
Introduction to UBIIntroduction to UBI
Introduction to UBI
Roy Lee
 
Python 4 Arc
Python 4 ArcPython 4 Arc
Python 4 Arc
absvis
 
Python programming - Everyday(ish) Examples
Python programming - Everyday(ish) ExamplesPython programming - Everyday(ish) Examples
Python programming - Everyday(ish) Examples
Ashish Sharma
 
Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2Introduction To Programming with Python Lecture 2
Introduction To Programming with Python Lecture 2
Syed Farjad Zia Zaidi
 
Cyberoam Firewall Presentation
Cyberoam Firewall PresentationCyberoam Firewall Presentation
Cyberoam Firewall Presentation
Manoj Kumar Mishra
 
introduction to python
introduction to pythonintroduction to python
introduction to python
Sardar Alam
 
流程語法與函式
流程語法與函式流程語法與函式
流程語法與函式
Justin Lin
 
Ad

Similar to Introduction To Programming with Python-3 (20)

python_strings.pdf
python_strings.pdfpython_strings.pdf
python_strings.pdf
rajendraprasadbabub1
 
Python data handling
Python data handlingPython data handling
Python data handling
Prof. Dr. K. Adisesha
 
Python Programming-UNIT-II - Strings.pptx
Python Programming-UNIT-II - Strings.pptxPython Programming-UNIT-II - Strings.pptx
Python Programming-UNIT-II - Strings.pptx
KavithaDonepudi
 
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdfpython1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
rohithzach
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
nitamhaske
 
string manipulation in python ppt for grade 11 cbse
string manipulation in python ppt for grade 11 cbsestring manipulation in python ppt for grade 11 cbse
string manipulation in python ppt for grade 11 cbse
KrithikaTM
 
Python String Revisited.pptx
Python String Revisited.pptxPython String Revisited.pptx
Python String Revisited.pptx
Chandrapriya Jayabal
 
Python Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptxPython Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptx
parmg0960
 
Strings brief introduction in python.pdf
Strings brief introduction in python.pdfStrings brief introduction in python.pdf
Strings brief introduction in python.pdf
TODAYIREAD1
 
Lexture about strings, all examples and theoretical part is included
Lexture about strings, all examples and theoretical part is includedLexture about strings, all examples and theoretical part is included
Lexture about strings, all examples and theoretical part is included
abzalbekulasbekov
 
UNIT 4 python.pptx
UNIT 4 python.pptxUNIT 4 python.pptx
UNIT 4 python.pptx
TKSanthoshRao
 
stringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
stringggg.pptxtujd7tttttttttttttttttttttttttttttttttttstringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
stringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
pawankamal3
 
STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
TanushTM1
 
strings in python (presentation for DSA)
strings in python (presentation for DSA)strings in python (presentation for DSA)
strings in python (presentation for DSA)
MirzaAbdullahTariq
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptx
Yagna15
 
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptxDATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
rajvishnuf9
 
Day5 String python language for btech.pptx
Day5 String python language for btech.pptxDay5 String python language for btech.pptx
Day5 String python language for btech.pptx
mrsam3062
 
PPS_Unit 4.ppt
PPS_Unit 4.pptPPS_Unit 4.ppt
PPS_Unit 4.ppt
KundanBhatkar
 
Python course
Python coursePython course
Python course
Евгений Сазонов
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
Tapaswini14
 
Python Programming-UNIT-II - Strings.pptx
Python Programming-UNIT-II - Strings.pptxPython Programming-UNIT-II - Strings.pptx
Python Programming-UNIT-II - Strings.pptx
KavithaDonepudi
 
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdfpython1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
python1uhaibueuhERADGAIUSAERUGHw9uSS.pdf
rohithzach
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
nitamhaske
 
string manipulation in python ppt for grade 11 cbse
string manipulation in python ppt for grade 11 cbsestring manipulation in python ppt for grade 11 cbse
string manipulation in python ppt for grade 11 cbse
KrithikaTM
 
Python Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptxPython Strings and its Featues Explained in Detail .pptx
Python Strings and its Featues Explained in Detail .pptx
parmg0960
 
Strings brief introduction in python.pdf
Strings brief introduction in python.pdfStrings brief introduction in python.pdf
Strings brief introduction in python.pdf
TODAYIREAD1
 
Lexture about strings, all examples and theoretical part is included
Lexture about strings, all examples and theoretical part is includedLexture about strings, all examples and theoretical part is included
Lexture about strings, all examples and theoretical part is included
abzalbekulasbekov
 
stringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
stringggg.pptxtujd7tttttttttttttttttttttttttttttttttttstringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
stringggg.pptxtujd7ttttttttttttttttttttttttttttttttttt
pawankamal3
 
STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
TanushTM1
 
strings in python (presentation for DSA)
strings in python (presentation for DSA)strings in python (presentation for DSA)
strings in python (presentation for DSA)
MirzaAbdullahTariq
 
Strings.pptx
Strings.pptxStrings.pptx
Strings.pptx
Yagna15
 
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptxDATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
DATA TYPES IN PYTHON jesjdjdjkdkkdk.pptx
rajvishnuf9
 
Day5 String python language for btech.pptx
Day5 String python language for btech.pptxDay5 String python language for btech.pptx
Day5 String python language for btech.pptx
mrsam3062
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
Tapaswini14
 
Ad

More from Syed Farjad Zia Zaidi (20)

Vision & sight
Vision & sightVision & sight
Vision & sight
Syed Farjad Zia Zaidi
 
Introduction to Computing with Java
Introduction to Computing with JavaIntroduction to Computing with Java
Introduction to Computing with Java
Syed Farjad Zia Zaidi
 
Web Application Architectures
Web Application ArchitecturesWeb Application Architectures
Web Application Architectures
Syed Farjad Zia Zaidi
 
Foundations of Virtual Instruction
Foundations of Virtual InstructionFoundations of Virtual Instruction
Foundations of Virtual Instruction
Syed Farjad Zia Zaidi
 
Programming for Everybody (Python)
Programming for Everybody (Python)Programming for Everybody (Python)
Programming for Everybody (Python)
Syed Farjad Zia Zaidi
 
Learn to Program: The Fundamentals
Learn to Program: The FundamentalsLearn to Program: The Fundamentals
Learn to Program: The Fundamentals
Syed Farjad Zia Zaidi
 
Introduction to Systematic Program Design - Part 1
Introduction to Systematic Program Design - Part 1Introduction to Systematic Program Design - Part 1
Introduction to Systematic Program Design - Part 1
Syed Farjad Zia Zaidi
 
Emerging Trends & Technologies in the Virtual K-12 Classroom
Emerging Trends & Technologies in the Virtual K-12 ClassroomEmerging Trends & Technologies in the Virtual K-12 Classroom
Emerging Trends & Technologies in the Virtual K-12 Classroom
Syed Farjad Zia Zaidi
 
An Introduction to Interactive Programming in Python 2014
An Introduction to Interactive Programming in Python 2014An Introduction to Interactive Programming in Python 2014
An Introduction to Interactive Programming in Python 2014
Syed Farjad Zia Zaidi
 
Internet History, Technology, and Security
Internet History, Technology, and SecurityInternet History, Technology, and Security
Internet History, Technology, and Security
Syed Farjad Zia Zaidi
 
Human-Computer Interaction
Human-Computer InteractionHuman-Computer Interaction
Human-Computer Interaction
Syed Farjad Zia Zaidi
 
Beginning Game Programming with C#
Beginning Game Programming with C#Beginning Game Programming with C#
Beginning Game Programming with C#
Syed Farjad Zia Zaidi
 
Programming Mobile Applications for Android Handheld Systems 2014
Programming Mobile Applications for Android Handheld Systems 2014Programming Mobile Applications for Android Handheld Systems 2014
Programming Mobile Applications for Android Handheld Systems 2014
Syed Farjad Zia Zaidi
 
Computer Science 101
Computer Science 101Computer Science 101
Computer Science 101
Syed Farjad Zia Zaidi
 
Software Requirement Specification - Software Pack Solution 14
Software Requirement Specification - Software Pack Solution 14Software Requirement Specification - Software Pack Solution 14
Software Requirement Specification - Software Pack Solution 14
Syed Farjad Zia Zaidi
 
Project Proposal - Software Pack Solution 14
Project Proposal - Software Pack Solution 14Project Proposal - Software Pack Solution 14
Project Proposal - Software Pack Solution 14
Syed Farjad Zia Zaidi
 
Database Diagram Tutorial-SQL Server 2012
Database Diagram Tutorial-SQL Server 2012Database Diagram Tutorial-SQL Server 2012
Database Diagram Tutorial-SQL Server 2012
Syed Farjad Zia Zaidi
 
MindMuscle Xtreme
MindMuscle XtremeMindMuscle Xtreme
MindMuscle Xtreme
Syed Farjad Zia Zaidi
 
How to connect database file to a 3-Tier Architecture Application and obtain ...
How to connect database file to a 3-Tier Architecture Application and obtain ...How to connect database file to a 3-Tier Architecture Application and obtain ...
How to connect database file to a 3-Tier Architecture Application and obtain ...
Syed Farjad Zia Zaidi
 
Level 1 DFD
Level 1 DFDLevel 1 DFD
Level 1 DFD
Syed Farjad Zia Zaidi
 
Introduction to Systematic Program Design - Part 1
Introduction to Systematic Program Design - Part 1Introduction to Systematic Program Design - Part 1
Introduction to Systematic Program Design - Part 1
Syed Farjad Zia Zaidi
 
Emerging Trends & Technologies in the Virtual K-12 Classroom
Emerging Trends & Technologies in the Virtual K-12 ClassroomEmerging Trends & Technologies in the Virtual K-12 Classroom
Emerging Trends & Technologies in the Virtual K-12 Classroom
Syed Farjad Zia Zaidi
 
An Introduction to Interactive Programming in Python 2014
An Introduction to Interactive Programming in Python 2014An Introduction to Interactive Programming in Python 2014
An Introduction to Interactive Programming in Python 2014
Syed Farjad Zia Zaidi
 
Internet History, Technology, and Security
Internet History, Technology, and SecurityInternet History, Technology, and Security
Internet History, Technology, and Security
Syed Farjad Zia Zaidi
 
Programming Mobile Applications for Android Handheld Systems 2014
Programming Mobile Applications for Android Handheld Systems 2014Programming Mobile Applications for Android Handheld Systems 2014
Programming Mobile Applications for Android Handheld Systems 2014
Syed Farjad Zia Zaidi
 
Software Requirement Specification - Software Pack Solution 14
Software Requirement Specification - Software Pack Solution 14Software Requirement Specification - Software Pack Solution 14
Software Requirement Specification - Software Pack Solution 14
Syed Farjad Zia Zaidi
 
Project Proposal - Software Pack Solution 14
Project Proposal - Software Pack Solution 14Project Proposal - Software Pack Solution 14
Project Proposal - Software Pack Solution 14
Syed Farjad Zia Zaidi
 
Database Diagram Tutorial-SQL Server 2012
Database Diagram Tutorial-SQL Server 2012Database Diagram Tutorial-SQL Server 2012
Database Diagram Tutorial-SQL Server 2012
Syed Farjad Zia Zaidi
 
How to connect database file to a 3-Tier Architecture Application and obtain ...
How to connect database file to a 3-Tier Architecture Application and obtain ...How to connect database file to a 3-Tier Architecture Application and obtain ...
How to connect database file to a 3-Tier Architecture Application and obtain ...
Syed Farjad Zia Zaidi
 

Recently uploaded (20)

Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
Insurance Tech Services
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Revolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management SoftwareRevolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management Software
Insurance Tech Services
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdfdp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework
Angelo Theodorou
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your wayPlooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptxwAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
How Insurance Policy Administration Streamlines Policy Lifecycle for Agile Op...
Insurance Tech Services
 
Code and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage OverlookCode and No-Code Journeys: The Coverage Overlook
Code and No-Code Journeys: The Coverage Overlook
Applitools
 
Integrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FMEIntegrating Survey123 and R&H Data Using FME
Integrating Survey123 and R&H Data Using FME
Safe Software
 
Porting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 WebinarPorting Qt 5 QML Modules to Qt 6 Webinar
Porting Qt 5 QML Modules to Qt 6 Webinar
ICS
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines OperationsHow Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Revolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management SoftwareRevolutionize Your Insurance Workflow with Claims Management Software
Revolutionize Your Insurance Workflow with Claims Management Software
Insurance Tech Services
 
dp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdfdp-700 exam questions sample docume .pdf
dp-700 exam questions sample docume .pdf
pravkumarbiz
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework
Angelo Theodorou
 
Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)Shell Skill Tree - LabEx Certification (LabEx)
Shell Skill Tree - LabEx Certification (LabEx)
VICTOR MAESTRE RAMIREZ
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Key AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence CompaniesKey AI Technologies Used by Indian Artificial Intelligence Companies
Key AI Technologies Used by Indian Artificial Intelligence Companies
Mypcot Infotech
 
IBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - IntroductionIBM Rational Unified Process For Software Engineering - Introduction
IBM Rational Unified Process For Software Engineering - Introduction
Gaurav Sharma
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your wayPlooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptxwAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 

Introduction To Programming with Python-3

  • 1. Introduction to Programming with Python – Class 3 SYED FARJAD ZIA ZAIDI
  • 2. Class Objectives Class Objective Understanding Strings and some useful string operations. Write few simple programs that use string functions and lists.
  • 3. Class Material •Chapter 6, 8 - Python for Informatics: Exploring Information Reading
  • 4. Strings  Strings are amongst the most popular types in Python. We can create them simply by enclosing characters in quotes. Python treats single quotes the same as double quotes.  Creating strings is as simple as assigning a value to a variable. For example: message = “Hello World”
  • 5. Introduction to Indexing  Strings can be divided into substrings using indexing.  To access substrings, use the square brackets for slicing along with the index or indices to obtain your substring, this is called Indexing. Following is a simple example: message = 'Hello World!' messageTwo = "Python Programming" print "var1[0]: ", message[0] print "var2[1:5]: ", messageTwo[1:5]
  • 6. String Concatenation  String concatenation is a process in which two strings are merged together. Concatenation is very simple and uses the operator ‘+’ to concatenate. For Example: message = “Hello” messageTwo = “ “ messageThree = “World” print message + messageTwo + messageThree
  • 7. Escape Characters  Following table is a list of commonly used escape or non-printable characters that can be represented with backslash notation. An escape character gets interpreted; in a single quoted as well as double quoted strings. Backslash Notation Description n New Line t Space s Tab
  • 8. String Special Operators + •Concatenation - Adds values on either side of the operator * •Repetition - Creates new strings, concatenating multiple copies of the same string
  • 9. Python Comparison Operators [] • Slice - Gives the character from the given index [ : ] •Range Slice - Gives the characters from the given range
  • 10. Python Comparison Operators in • Membership - Returns true if a character exists in the given string not in • Membership - Returns true if a character does not exist in the given string
  • 11. Python Triple Quotes  Python's triple quotes comes to the rescue by allowing strings to span multiple lines, including verbatim NEWLINEs, TABs, and any other special characters.
  • 12. String Functions: Method Description capitalize() Capitalizes first letter of string count(str, beg=0, end=len(string)) Counts how many times str occurs in string or in a substring of string if starting index beg and ending index end are given find(str, beg=0, end=len(string)) Determine if str occurs in string or in a substring of string if starting index beg and ending index end are given returns index if found and -1 otherwise index(str, beg=0, end=len(string)) Same as find(), but raises an error if str not found len(string) Returns the length of the string
  • 13. String Functions:  Go to the following link for more string functions: http://www.tutorialspoint.com/python/python_strings.htm  You can also find string functions by writing the following in the python IDLE help(str)
  • 14. Exercise 1  Write code using find() and string slicing to extract the number at the end of the line below. Convert the extracted value to a floating point number and print it out. text = "X-DSPAM-Confidence: 0.8475";
  • 15. Exercise 2  Given a string and a non-negative int n, return a larger string that is n copies of the original string. string_times('Hi', 2) → 'HiHi' string_times('Hi', 3) → 'HiHiHi' string_times('Hi', 1) → 'Hi'
  • 16. Exercise 3  Given a string, return a string where for every char in the original, there are two chars. double_char('The') → 'TThhee' double_char('AAbb') → 'AAAAbbbb' double_char('Hi-There') → 'HHii--TThheerree'
  • 17. Any Queries?  Link to Facebook Group: https://www.facebook.com/groups/introtopython.iccbs/  Email: [email protected]