SlideShare a Scribd company logo
Python strings
A QUICK RECAP
PRESENTED BY:
S.VEDA GAYATHRI
B.TECH (2nd)
Electronics and Instrumentation
engineering
NIT SILCHAR
A QUICK GLANCE OVER:
• PYTHON Strings
• Slicing Strings
• Modify Strings
• Concatenate Strings
• Format Strings
• Escape Characters
• String Methods
Python Strings
 A String is an array of characters, represented by quotation marks (‘ ’)or
double quotation marks (“ ”) .
 A string in python is a data type (str) or can also be used as a string literal.
How do we create a string and display it?
How do we create multiline strings?
Storage of strings
• Strings are stored as arrays
• Traversing through a string and accessing its elements can be done
using its indices.
• There is no character data type in python , it stores as a string of length
1.
How do we determine the length of the string?: len()
How do we check if a required word/letter is there in the
string?:keywords “in” & “not in”
How do we get the string printed in a desired range?
A[1]
A[0] A[2] A[3] A[4] A[5]
Slicing strings
• If a range of characters in a string are required slicing is used.
• The syntax for slicing is
strName[start:end]
• Here,
• strName is the name of the string
• Start is the index of the starting letter of range
• End is the index of the ending letter of range
How do we use slice syntax if we count from the end?
Negative indexing
Modify strings
• Few basic modifications that can be done to the strings
Upper() : Converts string to upper case letters
Lower(): Converts string to lower case letters
Strip(): Remove whitespaces in beginning or in the end
Replace(,): Replaces a string with another string
Split(): Seperates string if it finds a separator
• The functions are used on a particular string with a dot operator.
strName.upper()
Concatenation of strings
• Joining two different strings/data types is called Concatenation.
• Concatenation of different datatypes is not possible in python.
• This concatenation is done using ‘+’
• If two variables are of str data type they can be concatenated easily
with ‘+’
How do we perform addition of numbers with same operator?
Type Casting
How do we concatenate string and a number?
Format Strings
• Strings and the numbers can be linked using format method.
• It reserves a place for the number in the string using place holder with
curly braces { }
• The numbers are further assigned as the arguments passed through
the format()
• Values can be assigned to place holder to get the required order.
Escape Characters
• There are some illegal characters that we cannot use inside a string.
• Eg: the quotation marks , backslash etc..
• To insert the illegal characters , escape
character is used.
• It is a backslash followed by the illegal character.
• Some familiar escape characters:
Code Result
' Single Quote
 Backslash
n New Line
r Carriage Return
t Tab
b Backspace
f Form Feed
ooo Octal value
xhh Hex value
THANK YOU!!!
Queries Feedback

More Related Content

What's hot

Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
hydpy
 
Python Modules
Python ModulesPython Modules
Python Modules
Nitin Reddy Katkam
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
Mohammed Sikander
 
Python : Data Types
Python : Data TypesPython : Data Types
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Data types in python
Data types in pythonData types in python
Data types in python
RaginiJain21
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
Soba Arjun
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Namespaces
NamespacesNamespaces
Namespaces
Sangeetha S
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
TMARAGATHAM
 
Python basics
Python basicsPython basics
Python basics
Hoang Nguyen
 
Strings in c
Strings in cStrings in c
Strings in c
vampugani
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Mohammed Sikander
 
Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programming
sambitmandal
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Python for loop
Python for loopPython for loop
Python for loop
Aishwarya Deshmukh
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
Amisha Narsingani
 
List in Python
List in PythonList in Python
List in Python
Siddique Ibrahim
 

What's hot (20)

Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
 
Python Modules
Python ModulesPython Modules
Python Modules
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Dictionaries in Python
Dictionaries in PythonDictionaries in Python
Dictionaries in Python
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Namespaces
NamespacesNamespaces
Namespaces
 
Modules and packages in python
Modules and packages in pythonModules and packages in python
Modules and packages in python
 
Python basics
Python basicsPython basics
Python basics
 
Strings in c
Strings in cStrings in c
Strings in c
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programming
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Python for loop
Python for loopPython for loop
Python for loop
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
 
List in Python
List in PythonList in Python
List in Python
 

Similar to Python strings presentation

ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
SukhpreetSingh519414
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
Tapaswini14
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
hardii0991
 
BCSE101E_Python_Module5 (4).pdf
BCSE101E_Python_Module5 (4).pdfBCSE101E_Python_Module5 (4).pdf
BCSE101E_Python_Module5 (4).pdf
mukeshb0905
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
TanushTM1
 
Strings-Computer programming
Strings-Computer programmingStrings-Computer programming
Strings-Computer programming
nmahi96
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
Syed Farjad Zia Zaidi
 
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
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
adityakumawat625
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ayshwarya Baburam
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
rajkumar2792005
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf
ssusere19c741
 
Character Arrays and strings in c language
Character Arrays and strings in c languageCharacter Arrays and strings in c language
Character Arrays and strings in c language
mallikavin
 
11 Unit 1 Chapter 03 Data Handling
11   Unit 1 Chapter 03 Data Handling11   Unit 1 Chapter 03 Data Handling
11 Unit 1 Chapter 03 Data Handling
Praveen M Jigajinni
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
Praveen M Jigajinni
 
Unit-I-PPT-1.ppt
Unit-I-PPT-1.pptUnit-I-PPT-1.ppt
Unit-I-PPT-1.ppt
Chinmaya M. N
 
Chapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdfChapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdf
KirubelWondwoson1
 

Similar to Python strings presentation (20)

ppt notes python language operators and data
ppt notes python language operators and datappt notes python language operators and data
ppt notes python language operators and data
 
trisha comp ppt.pptx
trisha comp ppt.pptxtrisha comp ppt.pptx
trisha comp ppt.pptx
 
Engineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptxEngineering CS 5th Sem Python Module -2.pptx
Engineering CS 5th Sem Python Module -2.pptx
 
BCSE101E_Python_Module5 (4).pdf
BCSE101E_Python_Module5 (4).pdfBCSE101E_Python_Module5 (4).pdf
BCSE101E_Python_Module5 (4).pdf
 
Text and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHPText and Numbers (Data Types)in PHP
Text and Numbers (Data Types)in PHP
 
STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
 
Strings-Computer programming
Strings-Computer programmingStrings-Computer programming
Strings-Computer programming
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
 
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
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
strings.pdf
strings.pdfstrings.pdf
strings.pdf
 
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdfCOMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
COMPUTER SCIENCE SUPPORT MATERIAL CLASS 12.pdf
 
0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf0-Slot21-22-Strings.pdf
0-Slot21-22-Strings.pdf
 
Character Arrays and strings in c language
Character Arrays and strings in c languageCharacter Arrays and strings in c language
Character Arrays and strings in c language
 
11 Unit 1 Chapter 03 Data Handling
11   Unit 1 Chapter 03 Data Handling11   Unit 1 Chapter 03 Data Handling
11 Unit 1 Chapter 03 Data Handling
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
Unit-I-PPT-1.ppt
Unit-I-PPT-1.pptUnit-I-PPT-1.ppt
Unit-I-PPT-1.ppt
 
Chapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdfChapter 4 (Part II) - Array and Strings.pdf
Chapter 4 (Part II) - Array and Strings.pdf
 
Team 1
Team 1Team 1
Team 1
 

Recently uploaded

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 

Recently uploaded (20)

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 

Python strings presentation

  • 1. Python strings A QUICK RECAP PRESENTED BY: S.VEDA GAYATHRI B.TECH (2nd) Electronics and Instrumentation engineering NIT SILCHAR
  • 2. A QUICK GLANCE OVER: • PYTHON Strings • Slicing Strings • Modify Strings • Concatenate Strings • Format Strings • Escape Characters • String Methods
  • 3. Python Strings  A String is an array of characters, represented by quotation marks (‘ ’)or double quotation marks (“ ”) .  A string in python is a data type (str) or can also be used as a string literal. How do we create a string and display it? How do we create multiline strings?
  • 4. Storage of strings • Strings are stored as arrays • Traversing through a string and accessing its elements can be done using its indices. • There is no character data type in python , it stores as a string of length 1. How do we determine the length of the string?: len() How do we check if a required word/letter is there in the string?:keywords “in” & “not in” How do we get the string printed in a desired range? A[1] A[0] A[2] A[3] A[4] A[5]
  • 5. Slicing strings • If a range of characters in a string are required slicing is used. • The syntax for slicing is strName[start:end] • Here, • strName is the name of the string • Start is the index of the starting letter of range • End is the index of the ending letter of range How do we use slice syntax if we count from the end? Negative indexing
  • 6. Modify strings • Few basic modifications that can be done to the strings Upper() : Converts string to upper case letters Lower(): Converts string to lower case letters Strip(): Remove whitespaces in beginning or in the end Replace(,): Replaces a string with another string Split(): Seperates string if it finds a separator • The functions are used on a particular string with a dot operator. strName.upper()
  • 7. Concatenation of strings • Joining two different strings/data types is called Concatenation. • Concatenation of different datatypes is not possible in python. • This concatenation is done using ‘+’ • If two variables are of str data type they can be concatenated easily with ‘+’ How do we perform addition of numbers with same operator? Type Casting How do we concatenate string and a number?
  • 8. Format Strings • Strings and the numbers can be linked using format method. • It reserves a place for the number in the string using place holder with curly braces { } • The numbers are further assigned as the arguments passed through the format() • Values can be assigned to place holder to get the required order.
  • 9. Escape Characters • There are some illegal characters that we cannot use inside a string. • Eg: the quotation marks , backslash etc.. • To insert the illegal characters , escape character is used. • It is a backslash followed by the illegal character. • Some familiar escape characters: Code Result ' Single Quote Backslash n New Line r Carriage Return t Tab b Backspace f Form Feed ooo Octal value xhh Hex value