SlideShare a Scribd company logo
1 of 18
ART INTEGRATED PROJECT
ON STRINGS
COMPUTER SCIENCE
By: Tapaswini Panigrahi
Class: 12
Sec: B
Roll no. :20
Submitted to: Chinmayee
sir
INTRODUCTION TO STRINGS IN PYTHON
In Python, strings are an essential data type used to represent textual
data. A string is a sequence of characters enclosed in single quotes
('') or double quotes (""). It is a versatile and widely used data type
that allows programmers to manipulate and work with text
effectively. Strings in Python are immutable, meaning they cannot be
changed once created. They provide a convenient way to store and
manipulate textual information such as names, addresses, messages,
and more. Understanding how to work with strings is crucial for
various tasks, including data processing, input validation, text
analysis, and generating output. In this presentation, we will explore
the fundamentals of strings in Python, including their creation,
manipulation, and common operations.
DEFINITION OF STRINGS
In programming, a string is a data type that represents a sequence of
characters. It is a fundamental concept used to store and manipulate
textual data. In Python, strings are enclosed in either single quotes (“)
or double quotes (“ ”) and can include letters, numbers, symbols, and
spaces.
IMPORTANCE OF STRINGS IN
PROGRAMMING
Strings play a vital role in programming and are widely used in various
applications. Here are some key reasons why strings are important in
programming:
Text Representation: Strings provide a way to represent and manipulate
textual information such as names, addresses, messages, file paths, and
more. They allow programmers to work with human-readable data
effectively.
Input and Output Handling: Strings are essential for handling user input and
displaying output in programs. They enable the interaction between users
and software by accepting and processing text-based inputs and generating
meaningful responses.
Text Processing and Manipulation: Strings offer a wide range of operations
and methods to process and manipulate text data. These include operations
like concatenation, slicing, searching, replacing, and formatting. String
STRING LITERALS
SINGLE AND DOUBLE QUOTES
Single Quotation Mark
Represented as ‘ ‘
Single quotes for anything that behaves like an
Identifier.
Single quotes are used for regular expressions,
dict keys or SQL.
Eg. ‘We “welcome” you.’
Double Quotation Mark
Represented as ” “
Double quotes generally we used for text.
Double quotes are used for string
representation.
Eg. “Hello it’s me.”
UNDERSTANDING MUTABLE AND
IMMUTABLE IN PYTHON
In the programming world, understanding the concepts of mutability
and immutability is crucial, especially when working with Python.
Python, being a dynamically-typed language, allows us to manipulate
objects and change their state during program execution. However,
not all objects in Python behave in the same way when it comes to
modification. Some objects can be altered, while others remain
constant once created. This fundamental distinction between mutable
and immutable objects forms the cornerstone of Python’s design
philosophy. By comprehending the concepts of mutability and
immutability, developers can write more efficient, reliable, and bug-
free code. In this article, we will explore the concept of mutability and
immutability in Python, understand their differences, and examine
their implications in practical programming scenarios
IS STRING IMMUTABLE
•Yes, string is immutable data type . The content of
string once assigned cannot be altered than
•Trying to alter string content may lead an error.
STRING OPERATIONS
•Repetition
•Membership
•Slicing
•Concatenation
REPETITION
•Repetition as it name implies repreat the given string
•Asterisk (‘*’) is used as repetition operator.
MEMBERSHIP
•Membership operation refers to checking a string or character
is part or subpart of an existing string or not
•Python uses ‘in’ and ‘not in’ as membership operator.
•‘in’ returns true if the first string or character appears as
substring in the second string.
•‘not in’ returns true is the first string or character does not
appears as substring in the second string.
SLICING
•Extracting a specific part of string or substring is called slicing
•Subset occurred after slicing contains contiguous elements
•Slicing is done using index range
•End index is always excluded in resultant substring.
•Negative index can also be used for slicing.
CONCATENATION
•Concatenation refers to joining two strings.
•Plus (+) is used as concatenation operator.
Method Description
capitalize() Converts the first character to upper case
casefold() Converts string into lower case
center() Returns a centered string
count() Returns the number of times a specified value occurs in a
string
encode() Returns an encoded version of the string
endswith() Returns true if the string ends with the specified value
expandtabs() Sets the tab size of the string
find() Searches the string for a specified value and returns the
position of where it was found
format() Formats specified values in a string
format_map() Formats specified values in a string
index() Searches the string for a specified value and returns the
position of where it was found
PYTHON STRING METHODS
STRING LENGTH
USING THE LEN() FUNCTION
len() is a built-in function in python. You can use the len() to get the
length of the given string, array, list, tuple, dictionary, etc. You can
use len function to optimize the performance of the program. The
number of elements stored in the object is never calculated, so len
helps provide the number of elements
len() is a built-in function in python.You can use the len() to get the
length of the given string, array, list, tuple, dictionary, etc.
Value: the given value you want the length of.
Return value a return an integer value i.e. the length of the given
string, or array, or list, or collections.
PYTHON STRING COMPARISON
OPERATORS
In python language, we can compare two strings such as identifying whether the
two strings are equivalent to each other or not, or even which string is greater
or smaller than each other. Let us check some of the string comparison
operators used for this purpose below:
==: This operator checks whether two strings are equal.
!=: This operator checks whether two strings are not equal.
<: This operator checks whether the string on the left side is smaller than the
string on the right side.
<=: This operator checks whether the string on the left side is smaller or equal
to the string on the right side.
>: This operator checks whether the string on the left side is greater than the
string on the right side.
>=: This operator checks whether the string on the left side is greater than the
string on the right side.
PYTHON OUTPUT FORMATTING
In this tutorial, we will learn to format the output. Formatting and output
refer to presenting the output of a program. We can format the output in the
human-readable form or write the data into a file and some other specified
form. Sometimes we need to control the coming output so we can format it
according to our requirements. Users can handle strings by using string
slicing and concatenation operations to create any layout.
There are various ways to format output.
•We can use the f string method to format the string literals.
•The format() method of strings helps a user create a fancier output.
•We can also perform the string concatenation operations to create any layout
we want. The string class also has some methods that perform useful
operations for padding strings to given column width.
IMPORTANCE OF STRINGS IN REAL-
WORLD APPLICATIONS
String matching strategies or algorithms provide key role in various
real world problems or applications. A few of its imperative
applications are Spell Checkers, Spam Filters, Intrusion Detection
System, Search Engines, Plagiarism Detection, Bioinformatics, Digital
Forensics and Information Retrieval Systems etc.
Thank you

More Related Content

Similar to trisha comp ppt.pptx

Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdfalaparthi
 
UNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeUNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeRamanamurthy Banda
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESRushikesh Kolhe
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptxrohithprabhas1
 
Top Python Online Training Institutes in Bangalore
Top Python Online Training Institutes in BangaloreTop Python Online Training Institutes in Bangalore
Top Python Online Training Institutes in BangaloreSaagTechnologies
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Fresherszynofustechnology
 
What is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfWhat is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfNitish Banga
 
What is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfWhat is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfNitish Banga
 
python full notes data types string and tuple
python full notes data types string and tuplepython full notes data types string and tuple
python full notes data types string and tupleSukhpreetSingh519414
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizeIruolagbePius
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptxdeivanayagamramachan
 
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 HandlingPraveen M Jigajinni
 

Similar to trisha comp ppt.pptx (20)

Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdf
 
UNIT II_python Programming_aditya College
UNIT II_python Programming_aditya CollegeUNIT II_python Programming_aditya College
UNIT II_python Programming_aditya College
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
 
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptx
 
Unit 2 python
Unit 2 pythonUnit 2 python
Unit 2 python
 
Top Python Online Training Institutes in Bangalore
Top Python Online Training Institutes in BangaloreTop Python Online Training Institutes in Bangalore
Top Python Online Training Institutes in Bangalore
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Python Interview Questions For Freshers
Python Interview Questions For FreshersPython Interview Questions For Freshers
Python Interview Questions For Freshers
 
What is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfWhat is the Basic use of python (7).pdf
What is the Basic use of python (7).pdf
 
What is the Basic use of python (7).pdf
What is the Basic use of python (7).pdfWhat is the Basic use of python (7).pdf
What is the Basic use of python (7).pdf
 
AI_2nd Lab.pptx
AI_2nd Lab.pptxAI_2nd Lab.pptx
AI_2nd Lab.pptx
 
python full notes data types string and tuple
python full notes data types string and tuplepython full notes data types string and tuple
python full notes data types string and tuple
 
python (1).pdf
python (1).pdfpython (1).pdf
python (1).pdf
 
Python 3.x quick syntax guide
Python 3.x quick syntax guidePython 3.x quick syntax guide
Python 3.x quick syntax guide
 
Data Science Using Python.pptx
Data Science Using Python.pptxData Science Using Python.pptx
Data Science Using Python.pptx
 
Python (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualizePython (Data Analysis) cleaning and visualize
Python (Data Analysis) cleaning and visualize
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
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
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 

trisha comp ppt.pptx

  • 1. ART INTEGRATED PROJECT ON STRINGS COMPUTER SCIENCE By: Tapaswini Panigrahi Class: 12 Sec: B Roll no. :20 Submitted to: Chinmayee sir
  • 2. INTRODUCTION TO STRINGS IN PYTHON In Python, strings are an essential data type used to represent textual data. A string is a sequence of characters enclosed in single quotes ('') or double quotes (""). It is a versatile and widely used data type that allows programmers to manipulate and work with text effectively. Strings in Python are immutable, meaning they cannot be changed once created. They provide a convenient way to store and manipulate textual information such as names, addresses, messages, and more. Understanding how to work with strings is crucial for various tasks, including data processing, input validation, text analysis, and generating output. In this presentation, we will explore the fundamentals of strings in Python, including their creation, manipulation, and common operations.
  • 3. DEFINITION OF STRINGS In programming, a string is a data type that represents a sequence of characters. It is a fundamental concept used to store and manipulate textual data. In Python, strings are enclosed in either single quotes (“) or double quotes (“ ”) and can include letters, numbers, symbols, and spaces.
  • 4. IMPORTANCE OF STRINGS IN PROGRAMMING Strings play a vital role in programming and are widely used in various applications. Here are some key reasons why strings are important in programming: Text Representation: Strings provide a way to represent and manipulate textual information such as names, addresses, messages, file paths, and more. They allow programmers to work with human-readable data effectively. Input and Output Handling: Strings are essential for handling user input and displaying output in programs. They enable the interaction between users and software by accepting and processing text-based inputs and generating meaningful responses. Text Processing and Manipulation: Strings offer a wide range of operations and methods to process and manipulate text data. These include operations like concatenation, slicing, searching, replacing, and formatting. String
  • 5. STRING LITERALS SINGLE AND DOUBLE QUOTES Single Quotation Mark Represented as ‘ ‘ Single quotes for anything that behaves like an Identifier. Single quotes are used for regular expressions, dict keys or SQL. Eg. ‘We “welcome” you.’ Double Quotation Mark Represented as ” “ Double quotes generally we used for text. Double quotes are used for string representation. Eg. “Hello it’s me.”
  • 6. UNDERSTANDING MUTABLE AND IMMUTABLE IN PYTHON In the programming world, understanding the concepts of mutability and immutability is crucial, especially when working with Python. Python, being a dynamically-typed language, allows us to manipulate objects and change their state during program execution. However, not all objects in Python behave in the same way when it comes to modification. Some objects can be altered, while others remain constant once created. This fundamental distinction between mutable and immutable objects forms the cornerstone of Python’s design philosophy. By comprehending the concepts of mutability and immutability, developers can write more efficient, reliable, and bug- free code. In this article, we will explore the concept of mutability and immutability in Python, understand their differences, and examine their implications in practical programming scenarios
  • 7. IS STRING IMMUTABLE •Yes, string is immutable data type . The content of string once assigned cannot be altered than •Trying to alter string content may lead an error.
  • 9. REPETITION •Repetition as it name implies repreat the given string •Asterisk (‘*’) is used as repetition operator.
  • 10. MEMBERSHIP •Membership operation refers to checking a string or character is part or subpart of an existing string or not •Python uses ‘in’ and ‘not in’ as membership operator. •‘in’ returns true if the first string or character appears as substring in the second string. •‘not in’ returns true is the first string or character does not appears as substring in the second string.
  • 11. SLICING •Extracting a specific part of string or substring is called slicing •Subset occurred after slicing contains contiguous elements •Slicing is done using index range •End index is always excluded in resultant substring. •Negative index can also be used for slicing.
  • 12. CONCATENATION •Concatenation refers to joining two strings. •Plus (+) is used as concatenation operator.
  • 13. Method Description capitalize() Converts the first character to upper case casefold() Converts string into lower case center() Returns a centered string count() Returns the number of times a specified value occurs in a string encode() Returns an encoded version of the string endswith() Returns true if the string ends with the specified value expandtabs() Sets the tab size of the string find() Searches the string for a specified value and returns the position of where it was found format() Formats specified values in a string format_map() Formats specified values in a string index() Searches the string for a specified value and returns the position of where it was found PYTHON STRING METHODS
  • 14. STRING LENGTH USING THE LEN() FUNCTION len() is a built-in function in python. You can use the len() to get the length of the given string, array, list, tuple, dictionary, etc. You can use len function to optimize the performance of the program. The number of elements stored in the object is never calculated, so len helps provide the number of elements len() is a built-in function in python.You can use the len() to get the length of the given string, array, list, tuple, dictionary, etc. Value: the given value you want the length of. Return value a return an integer value i.e. the length of the given string, or array, or list, or collections.
  • 15. PYTHON STRING COMPARISON OPERATORS In python language, we can compare two strings such as identifying whether the two strings are equivalent to each other or not, or even which string is greater or smaller than each other. Let us check some of the string comparison operators used for this purpose below: ==: This operator checks whether two strings are equal. !=: This operator checks whether two strings are not equal. <: This operator checks whether the string on the left side is smaller than the string on the right side. <=: This operator checks whether the string on the left side is smaller or equal to the string on the right side. >: This operator checks whether the string on the left side is greater than the string on the right side. >=: This operator checks whether the string on the left side is greater than the string on the right side.
  • 16. PYTHON OUTPUT FORMATTING In this tutorial, we will learn to format the output. Formatting and output refer to presenting the output of a program. We can format the output in the human-readable form or write the data into a file and some other specified form. Sometimes we need to control the coming output so we can format it according to our requirements. Users can handle strings by using string slicing and concatenation operations to create any layout. There are various ways to format output. •We can use the f string method to format the string literals. •The format() method of strings helps a user create a fancier output. •We can also perform the string concatenation operations to create any layout we want. The string class also has some methods that perform useful operations for padding strings to given column width.
  • 17. IMPORTANCE OF STRINGS IN REAL- WORLD APPLICATIONS String matching strategies or algorithms provide key role in various real world problems or applications. A few of its imperative applications are Spell Checkers, Spam Filters, Intrusion Detection System, Search Engines, Plagiarism Detection, Bioinformatics, Digital Forensics and Information Retrieval Systems etc.