SlideShare a Scribd company logo
 Find length of string
 Accessing individual characters/slicing
 Difference between string and list.
 Convert to lowercase / uppercase / titlecase /
swapcase
 Verify if the strings consists of
alphabets/digits/upper/lower
 Split string
 Find substring
 A string is a sequence of characters.
 We can create string by enclosing characters in quotes.
 Python treats single quotes the same as double quotes.
 Python uses Unicode format to represent characters.
 Reading and Printing a string
 We can access individual characters of
string using indexing.
 If we try to access index out of the range or use
decimal number, we will get errors.
 Since there is no separate “character” type, indexing a
string produces strings of length 1
 We can access substrings using slicing
 Joining of two or more strings into a single
one is called concatenation.
 The + operator does this in Python.
 The * operator can be used to repeat the
string for a given number of times.
 Using for loop we can iterate through a
string.
str.isalnum()
str.isalpha()
str.isdigit()
str.islower()
str.isspace()
str.isupper()
str.istitle()
 Write code to check if the given password is strong or not.
str.lower() Convert all characters to lowercase
str.upper() Convert all characters to uppercase
str.swapcase() Convert uppercase to lowercase and
vice versa
str.title() First char of each word is changed to
uppercase and others to lowercase
str.capitalize() First char of the string is changed to
uppercase others to lowercase
 You are given a string and your task is to swap cases. In other words,
convert all lowercase letters to uppercase letters and vice versa.
 Count the number of vowels in a string.
str.count(sub) Return the number of non-overlapping occurrences of
substring sub .
str.find(sub) Return the lowest index in the string where substring sub is
found. Return -1 if sub is not found.
str.index(sub) Like find(), but raiseValueError when the substring is not found.
str.split(sep = None) Return a list of the words in the string, using sep as the
delimiter string.
S.join(list) Return a string which is the concatenation of the strings in the
list. The separator between elements is S.
Count number of overlapping substrings
 Return a list of the words in String
 Default separator is any space(space,newline,tab)
 To specify any other separator, specify it explicitly.
 Used to efficiently construct strings from multiple
fragments.
 str.join(iterable)
 Return a string which is the concatenation of the strings
in iterable.
 The separator between elements is the string providing
this method.
 A TypeError will be raised if there are any non-string
values in iterable.
 vowels = ['a', 'e', 'i', 'o', 'u']
 vowels
 ['a', 'e', 'i', 'o', 'u']
 s = "-".join(vowels)
 s
 'a-e-i-o-u'
 nums = [12,23,21,43,56]
 nums
 [12, 23, 21, 43, 56]
 s = "".join(nums)
 TypeError: sequence item 0: expected str
instance, int found
 s = "".join(map(str , nums) )
 s
 '1223214356'
 Replace method
 An anagram is a word or phrase formed by
rearranging the letters of a different word or
phrase, typically using all the original letters
exactly once.
 Anagram Example:
LISTEN SILENT
BINARY BRAINY
SCHOOL MASTER THE CLASSROOM
CAR ARC
 Given two strings, verify if they are anagram
 Pangram is a sentence containing every letter of
the alphabet.
 Given a sentence, determine whether it is
pangram, ignore case.
 Pangram Examples:
 The quick brown fox jumps over the lazy dog
 Two driven jocks help fax my big quiz.​
 Pack my box with five dozen liquor jugs.
 The five boxing wizards jump quickly.
 Bright vixens jump; dozy fowl quack.
 Write a program to verify if the given string has all
unique characters
 Write a program to remove all duplicate characters
from a string.
Python strings

More Related Content

What's hot

Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
eShikshak
 
Date and Time Module in Python | Edureka
Date and Time Module in Python | EdurekaDate and Time Module in Python | Edureka
Date and Time Module in Python | Edureka
Edureka!
 
String in c programming
String in c programmingString in c programming
String in c programming
Devan Thakur
 
List in Python
List in PythonList in Python
List in Python
Siddique Ibrahim
 
List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionary
nitamhaske
 
Chapter 14 strings
Chapter 14 stringsChapter 14 strings
Chapter 14 strings
Praveen M Jigajinni
 
Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
hydpy
 
Python : Data Types
Python : Data TypesPython : Data Types
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
Devashish Kumar
 
Python Modules
Python ModulesPython Modules
Python Modules
Nitin Reddy Katkam
 
Array in c
Array in cArray in c
Array in c
Ravi Gelani
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
Piyush rai
 
Python-03| Data types
Python-03| Data typesPython-03| Data types
Python-03| Data types
Mohd Sajjad
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
Neeru Mittal
 
Lists
ListsLists
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in Python
PriyankaC44
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
Mohd Sajjad
 
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
 

What's hot (20)

Strings
StringsStrings
Strings
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Date and Time Module in Python | Edureka
Date and Time Module in Python | EdurekaDate and Time Module in Python | Edureka
Date and Time Module in Python | Edureka
 
String in c programming
String in c programmingString in c programming
String in c programming
 
List in Python
List in PythonList in Python
List in Python
 
List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionary
 
Chapter 14 strings
Chapter 14 stringsChapter 14 strings
Chapter 14 strings
 
Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
Strings in C
Strings in CStrings in C
Strings in C
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Python Modules
Python ModulesPython Modules
Python Modules
 
Array in c
Array in cArray in c
Array in c
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
 
Python-03| Data types
Python-03| Data typesPython-03| Data types
Python-03| Data types
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Lists
ListsLists
Lists
 
Looping Statements and Control Statements in Python
Looping Statements and Control Statements in PythonLooping Statements and Control Statements in Python
Looping Statements and Control Statements in Python
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 

Similar to Python strings

Python data handling
Python data handlingPython data handling
Python data handling
Prof. Dr. K. Adisesha
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
Shree M.L.Kakadiya MCA mahila college, Amreli
 
unit-4 regular expression.pptx
unit-4 regular expression.pptxunit-4 regular expression.pptx
unit-4 regular expression.pptx
PadreBhoj
 
Strings.ppt
Strings.pptStrings.ppt
Strings.ppt
SanthiyaAK
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
Eduardo Bergavera
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9Vince Vo
 
regex.pptx
regex.pptxregex.pptx
regex.pptx
qnuslv
 
Regular_Expressions.pptx
Regular_Expressions.pptxRegular_Expressions.pptx
Regular_Expressions.pptx
DurgaNayak4
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdf
GaneshRaghu4
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
Mukesh Tekwani
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arraysphanleson
 
python_strings.pdf
python_strings.pdfpython_strings.pdf
python_strings.pdf
rajendraprasadbabub1
 
13string in c#
13string in c#13string in c#
13string in c#
Sireesh K
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regexwayn
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
nitamhaske
 
Trie Data Structure
Trie Data Structure Trie Data Structure
Trie Data Structure
Hitesh Mohapatra
 
Data structures in Python
Data structures in PythonData structures in Python
Data structures in Python
MITULJAMANG
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdf
DrIsikoIsaac
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
adityakumawat625
 
Introduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RIntroduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RHellen Gakuruh
 

Similar to Python strings (20)

Python data handling
Python data handlingPython data handling
Python data handling
 
Adv. python regular expression by Rj
Adv. python regular expression by RjAdv. python regular expression by Rj
Adv. python regular expression by Rj
 
unit-4 regular expression.pptx
unit-4 regular expression.pptxunit-4 regular expression.pptx
unit-4 regular expression.pptx
 
Strings.ppt
Strings.pptStrings.ppt
Strings.ppt
 
Chapter 9 - Characters and Strings
Chapter 9 - Characters and StringsChapter 9 - Characters and Strings
Chapter 9 - Characters and Strings
 
Java căn bản - Chapter9
Java căn bản - Chapter9Java căn bản - Chapter9
Java căn bản - Chapter9
 
regex.pptx
regex.pptxregex.pptx
regex.pptx
 
Regular_Expressions.pptx
Regular_Expressions.pptxRegular_Expressions.pptx
Regular_Expressions.pptx
 
Module 3 - Regular Expressions, Dictionaries.pdf
Module 3 - Regular  Expressions,  Dictionaries.pdfModule 3 - Regular  Expressions,  Dictionaries.pdf
Module 3 - Regular Expressions, Dictionaries.pdf
 
Python - Regular Expressions
Python - Regular ExpressionsPython - Regular Expressions
Python - Regular Expressions
 
Strings Arrays
Strings ArraysStrings Arrays
Strings Arrays
 
python_strings.pdf
python_strings.pdfpython_strings.pdf
python_strings.pdf
 
13string in c#
13string in c#13string in c#
13string in c#
 
16 Java Regex
16 Java Regex16 Java Regex
16 Java Regex
 
Strings in Python
Strings in PythonStrings in Python
Strings in Python
 
Trie Data Structure
Trie Data Structure Trie Data Structure
Trie Data Structure
 
Data structures in Python
Data structures in PythonData structures in Python
Data structures in Python
 
Chapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdfChapter2CDpdf__2021_11_26_09_19_08.pdf
Chapter2CDpdf__2021_11_26_09_19_08.pdf
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
 
Introduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_RIntroduction_to_Regular_Expressions_in_R
Introduction_to_Regular_Expressions_in_R
 

More from Mohammed Sikander

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Mohammed Sikander
 
Operator Overloading in C++
Operator Overloading in C++Operator Overloading in C++
Operator Overloading in C++
Mohammed Sikander
 
Python_Regular Expression
Python_Regular ExpressionPython_Regular Expression
Python_Regular Expression
Mohammed Sikander
 
Modern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptxModern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptx
Mohammed Sikander
 
Modern_cpp_auto.pdf
Modern_cpp_auto.pdfModern_cpp_auto.pdf
Modern_cpp_auto.pdf
Mohammed Sikander
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
Mohammed Sikander
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
Mohammed Sikander
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
Mohammed Sikander
 
Python tuple
Python   tuplePython   tuple
Python tuple
Mohammed Sikander
 
Python set
Python setPython set
Python set
Mohammed Sikander
 
Python list
Python listPython list
Python list
Mohammed Sikander
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
Mohammed Sikander
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
Mohammed Sikander
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
Mohammed Sikander
 
Pipe
PipePipe
Signal
SignalSignal
File management
File managementFile management
File management
Mohammed Sikander
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
Mohammed Sikander
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
Mohammed Sikander
 

More from Mohammed Sikander (20)

Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Operator Overloading in C++
Operator Overloading in C++Operator Overloading in C++
Operator Overloading in C++
 
Python_Regular Expression
Python_Regular ExpressionPython_Regular Expression
Python_Regular Expression
 
Modern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptxModern_CPP-Range-Based For Loop.pptx
Modern_CPP-Range-Based For Loop.pptx
 
Modern_cpp_auto.pdf
Modern_cpp_auto.pdfModern_cpp_auto.pdf
Modern_cpp_auto.pdf
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Python exception handling
Python   exception handlingPython   exception handling
Python exception handling
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
Python set
Python setPython set
Python set
 
Python list
Python listPython list
Python list
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
Pointer basics
Pointer basicsPointer basics
Pointer basics
 
Pipe
PipePipe
Pipe
 
Signal
SignalSignal
Signal
 
File management
File managementFile management
File management
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
CPP Language Basics - Reference
CPP Language Basics - ReferenceCPP Language Basics - Reference
CPP Language Basics - Reference
 

Recently uploaded

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
 
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
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
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
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
varshanayak241
 
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
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
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
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
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
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
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
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 

Recently uploaded (20)

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...
 
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?
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
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
 
Strategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptxStrategies for Successful Data Migration Tools.pptx
Strategies for Successful Data Migration Tools.pptx
 
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 ...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
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...
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
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
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
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...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 

Python strings

  • 1.
  • 2.  Find length of string  Accessing individual characters/slicing  Difference between string and list.  Convert to lowercase / uppercase / titlecase / swapcase  Verify if the strings consists of alphabets/digits/upper/lower  Split string  Find substring
  • 3.  A string is a sequence of characters.  We can create string by enclosing characters in quotes.  Python treats single quotes the same as double quotes.  Python uses Unicode format to represent characters.
  • 4.  Reading and Printing a string
  • 5.  We can access individual characters of string using indexing.  If we try to access index out of the range or use decimal number, we will get errors.
  • 6.  Since there is no separate “character” type, indexing a string produces strings of length 1
  • 7.  We can access substrings using slicing
  • 8.  Joining of two or more strings into a single one is called concatenation.  The + operator does this in Python.  The * operator can be used to repeat the string for a given number of times.
  • 9.  Using for loop we can iterate through a string.
  • 10.
  • 12.
  • 13.  Write code to check if the given password is strong or not.
  • 14. str.lower() Convert all characters to lowercase str.upper() Convert all characters to uppercase str.swapcase() Convert uppercase to lowercase and vice versa str.title() First char of each word is changed to uppercase and others to lowercase str.capitalize() First char of the string is changed to uppercase others to lowercase
  • 15.
  • 16.  You are given a string and your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa.
  • 17.  Count the number of vowels in a string.
  • 18. str.count(sub) Return the number of non-overlapping occurrences of substring sub . str.find(sub) Return the lowest index in the string where substring sub is found. Return -1 if sub is not found. str.index(sub) Like find(), but raiseValueError when the substring is not found. str.split(sep = None) Return a list of the words in the string, using sep as the delimiter string. S.join(list) Return a string which is the concatenation of the strings in the list. The separator between elements is S.
  • 19.
  • 20. Count number of overlapping substrings
  • 21.
  • 22.  Return a list of the words in String
  • 23.  Default separator is any space(space,newline,tab)  To specify any other separator, specify it explicitly.
  • 24.  Used to efficiently construct strings from multiple fragments.  str.join(iterable)  Return a string which is the concatenation of the strings in iterable.  The separator between elements is the string providing this method.  A TypeError will be raised if there are any non-string values in iterable.
  • 25.  vowels = ['a', 'e', 'i', 'o', 'u']  vowels  ['a', 'e', 'i', 'o', 'u']  s = "-".join(vowels)  s  'a-e-i-o-u'
  • 26.  nums = [12,23,21,43,56]  nums  [12, 23, 21, 43, 56]  s = "".join(nums)  TypeError: sequence item 0: expected str instance, int found  s = "".join(map(str , nums) )  s  '1223214356'
  • 28.
  • 29.  An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.  Anagram Example: LISTEN SILENT BINARY BRAINY SCHOOL MASTER THE CLASSROOM CAR ARC
  • 30.  Given two strings, verify if they are anagram
  • 31.
  • 32.  Pangram is a sentence containing every letter of the alphabet.  Given a sentence, determine whether it is pangram, ignore case.  Pangram Examples:  The quick brown fox jumps over the lazy dog  Two driven jocks help fax my big quiz.​  Pack my box with five dozen liquor jugs.  The five boxing wizards jump quickly.  Bright vixens jump; dozy fowl quack.
  • 33.
  • 34.  Write a program to verify if the given string has all unique characters
  • 35.  Write a program to remove all duplicate characters from a string.