SlideShare une entreprise Scribd logo
1  sur  55
PYTHON AND WEB DEVELOPMENT
INSTRUCTIONS TO ATTENDEES
Keep the microphone and camera off throughout the
session
Use hand raise option to acknowledge the host
Post your answers in the chat box
Any specific doubt related to content/problem kindly
ask in the Q&A tab.
A mentor will be allocated to clarify all your doubts
which were posted in Q&A area.
PREVIOUS SESSION
DICTIONARIES AND SETS
PROBLEM SOLVING ON DICTIONARIES AND SETS
CONTENT
STRINGS IN PYTHON
BUILT-IN FUNCTIONS
CODE
• A string is a sequence of characters..
• String literals in python are surrounded by either single quotation marks, or double
quotation marks.
INTRODUCTION
h e l l o
CREATING A STRING
• Strings can be created by enclosing
characters inside a single quote or double-
quotes.
• Anything given as input is basically
considered as string.
ACCESSING ELEMENTS IN A STRING
Like list, string elements can also be accessed using indexing.
0 1 2 3 4 5
P Y T H O N
-6 -5 -4 -3 -2 -1
indexing
Negative
indexing
MODIFY A STRING
• Strings are immutable, hence elements
of a String cannot be changed once it
has been assigned.
• Only new strings can be reassigned to
the same name.
DELETE A STRING
• We can directly delete a string using del
keyword.
• Delete a string using index is not possible.
STRING METHODS AND FUNCTIONS
• String.ascii_letters:
Concatenation of the ascii_lowercase and
ascii_uppercase constants.
• string.ascii_lowercase:
Concatenation of lowercase letters
• string.ascii_uppercase:
Concatenation of uppercase letters
• string.punctuation:
ASCII characters having punctuation characters.
STRING METHODS AND FUNCTIONS
• string.digits:
Digit in strings
• string.hexdigits:
Hexadigit in strings
• string.octdigits:
Octadigit in a string
STRING METHODS AND FUNCTIONS
• string.endswith():
Returns True if a string ends with the given
suffix otherwise returns False
• string.startswith():
Returns True if a string starts with the given
prefix otherwise returns False
• replace():
returns a copy of the string where all
occurrences of a substring is replaced with
another substring.
STRING METHODS AND FUNCTIONS
• string.isdigit():
Returns “True” if all characters in the string
are digits, Otherwise, It returns “False”.
• string.isalpha():
Returns “True” if all characters in the string
are alphabets, Otherwise, It returns “False”.
• string.isdecimal():
Returns true if all characters in a string are
decimal.
STRING METHODS AND FUNCTIONS
• string.isalnum():
Returns true if all the characters in a
given string are alphanumeric.
• string.istitle():
Returns True if the string is a titlecased
string
STRING METHODS AND FUNCTIONS
• string.upper():
Returns the string with all uppercases.
• string.lower():
Returns the string with all lowercases.
• string.swapcase():
Method converts all uppercase
characters to lowercase and vice versa
of the given string, and returns it
STRING METHODS AND FUNCTIONS
• string.partition:
splits the string at the first occurrence of the
separator and returns a tuple.
• string.index:
Returns the position of the first occurrence of
substring in a string.
• string.rindex:
Returns the highest index of the substring inside the
string if substring is found.
• string.splitlines:
Returns a list of lines in the string.
STRING METHODS AND FUNCTIONS
• string.capitalize:
Return a word with its first character
capitalized.
• string.find:
Return the lowest index in a sub string.
• string.rfind:
find the highest index.
• string.count:
Return the number of (non-overlapping)
occurrences of substring sub in string
STRING METHODS AND FUNCTIONS
• len():
Returns the length of the string.
• max():
Returns the highest alphabetical
character in a string.
• min():
Returns the minimum alphabetical
character in a string.
SLICING A STRING
S[:] – prints all the elements from the string.
S[2:] – prints all the elements from the string
starting from index 2
S[:5] – prints all the elements from the string till
the ending index 4
S[2:6] – prints the elements from the string from
index 2 till index 5
S[-4:-2] – prints the elements from the string
from index -4 till index -3
SLICING A STRING
S[::2] – prints all the elements from the string with
step 2 (index+2 element) from the beginning.
S[::-1] – prints all the elements from the string with
step 1 (index+1) from the last.
S[1:6:3] – prints all the elements from the string from
index 1 till index 5 with steps 3.
GUESS THE OUTPUT ?
Guess the correct output of the following String operations
A)WelcomeWelcome
B)TypeError: unsupported operand type(s) for * or pow(): ‘str’ and
‘int’
a
GUESS THE OUTPUT ?
Select the correct output of the following String operations
A)Welcome Coder
B)WelcomCoder
C)Welcom Coder
D)WelcomeCoder
c
GUESS THE OUTPUT ?
What is the output of the following code
A)False
True
B)False
False
C)True
False
a
METHOD
String.ascii_letters:
string.punctuation:
replace():
string.isdecimal():
string.istitle:
string.isalnum:
string.rindex:
string.partition:
string.capitalize:
DESCRIPTION
returns a copy of the string where all occurrences of a substring is
replaced with another substring.
Returns True if the string is a titlecased string
Concatenation of the ascii_lowercase and ascii_uppercase constants.
splits the string at the first occurrence of the separator and returns a
tuple.
ASCII characters having punctuation characters.
Returns true if all characters in a string are decimal.
Returns true if all the characters in a given string are alphanumeric.
Return a word with its first character capitalized.
Returns the highest index of the substring inside the string if
substring is found.
MATCH THE METHOD WITH ITS DESCRIPTION
METHOD
String.ascii_letters:
string.punctuation:
replace():
string.isdecimal():
string.istitle:
string.isalnum:
string.rindex:
string.partition:
string.capitalize:
MATCH THE METHOD WITH ITS DESCRIPTION
DESCRIPTION
returns a copy of the string where all occurrences of a substring is
replaced with another substring.
Returns True if the string is a titlecased string
Concatenation of the ascii_lowercase and ascii_uppercase constants.
splits the string at the first occurrence of the separator and returns a
tuple.
ASCII characters having punctuation characters.
Returns true if all characters in a string are decimal.
Returns true if all the characters in a given string are alphanumeric.
Return a word with its first character capitalized.
Returns the highest index of the substring inside the string if
substring is found.
LET’S START CODING
PROBLEM STATEMENT 1
Write a Python program to calculate the length of a string.
Input Format:
Read a string.
Output Format:
Print the length of a string.
Test cases:
Sample Input Sample Output
coder123 8
programming 11
CODE
PROBLEM STATEMENT 2
Write a Python script that takes input from the user and displays that input back in
upper and lower cases.
Input Format:
Read a string
Output Format:
Print the string in both upper and lower case.
Test Cases:
Sample Input Sample Output
talentio Your input in upper case TALENTIO
Your input in lower case talentio
python Your input in upper case PYTHON
Your input in lower case python
CODE
PROBLEM STATEMENT 3
Write a Python program to swap cases of a given string.
Input Format:
Read a string.
Output Format:
Print the swapped cases of given string.
Test Cases:
Sample Input Sample Output
CoDeR cOdEr
tAlEnTiO TaLeNtIo
CODE
PROBLEM STATEMENT 4
Write a Python program to remove all consecutive duplicates from a given string.
Input Format:
Read a string.
Output Format:
Print the string after removing all consecutive duplicates.
Test Cases:
Sample Input Sample Output
aabcsa "abcsa"
pqqrrsrt "pqrsrt"
CODE
PROBLEM STATEMENT 5
Write a Python program to move all spaces to the front of a given string in single
traversal.
Input Format:
Read a string.
Output Format:
Print the string after eliminating spaces.
Test Cases:
Sample Input Sample Output
Python program " pythonprogram"
try catch exception " trycatchexception"
CODE
PROBLEM STATEMENT 6
Write a Python program to create a string from two given strings concatenating
uncommon characters of the said strings.
Input Format:
Read a string.
Output Format:
Print the new string.
Test Cases:
Sample Input Sample Output
Talentio
Solution
TaSu
Python
Program
ythngam
CODE
PROBLEM STATEMENT 7
Write a Python program to find the maximum occurring character in a given string.
Input Format:
Read a string.
Output Format:
Print the maximum occuring character.
Test Cases:
Sample Input Sample Output
Treat t
Tunnel n
CODE
PROBLEM STATEMENT 8
Write a Python program to check whether a string contains all letters of the alphabet.
Input Format:
Read a string.
Output Format:
Print whether the string contains all alphabets.
Test Cases:
Sample Input Sample Output
The quick brown fox jumps over
the lazy dog
True
Turn over False
CODE
PROBLEM STATEMENT 9
Write a Python program to convert a string in a list.
Input Format:
Read a string.
Output Format:
Print the list after converting the string to list.
Test Cases:
Sample Input Sample Output
"python programmer" ["python" , "programmer"]
Coding challenge ["Coding","challenge"]
CODE
PROBLEM STATEMENT 10
Write a Python program to remove the characters which have odd index values of a
given string.
Input Format:
Read a string.
Output Format:
Print the string after removing odd characters.
Test Cases:
Sample Input Sample Output
abcde "ace"
player "pae"
CODE
YOUR TURN NOW
ASSIGNMENT QUESTION 1
Write a Python function that takes a list of words and returns the length of the
longest one.
Input Format:
Read the list of strings.
Output Format:
Print the length of longest word.
Test Cases:
Sample Input Sample Output
["talentio","coding","programmer
"]
10
["hello","Banglore"] 8
ASSIGNMENT QUESTION 2
Write a Python program to capitalize first and last letters of each word of a given
string.
Input Format:
Read the string.
Output Format:
Print the string after captalizing first and last letters in each word.
Test Cases:
Sample Input Sample Output
programmer ProgrammeR
coding CodinG
SUMMARY
STRINGS AND ITS BUILTIN FUNCTIONS AND METHODS
PROBLEM SOLVING ON STRINGS
PRACTICE CODING
ANY QUERIES?
POST TRAINING - DOUBTS
OR
Scan this QR code and
say “Hi”
KEEP WAITING FOR NEXT SESSION
THANK YOU

Contenu connexe

Similaire à STRINGS_IN_PYTHON 9-12 (1).pptx

Similaire à STRINGS_IN_PYTHON 9-12 (1).pptx (20)

Python_Regular Expression
Python_Regular ExpressionPython_Regular Expression
Python_Regular Expression
 
Introduction To Programming with Python-3
Introduction To Programming with Python-3Introduction To Programming with Python-3
Introduction To Programming with Python-3
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
String in programming language in c or c++
 String in programming language  in c or c++  String in programming language  in c or c++
String in programming language in c or c++
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
Python Basics
Python BasicsPython Basics
Python Basics
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
Lenguaje Python
Lenguaje PythonLenguaje Python
Lenguaje Python
 
pysdasdasdsadsadsadsadsadsadasdasdthon1.ppt
pysdasdasdsadsadsadsadsadsadasdasdthon1.pptpysdasdasdsadsadsadsadsadsadasdasdthon1.ppt
pysdasdasdsadsadsadsadsadsadasdasdthon1.ppt
 
coolstuff.ppt
coolstuff.pptcoolstuff.ppt
coolstuff.ppt
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
Introductio_to_python_progamming_ppt.ppt
Introductio_to_python_progamming_ppt.pptIntroductio_to_python_progamming_ppt.ppt
Introductio_to_python_progamming_ppt.ppt
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
python1.ppt
python1.pptpython1.ppt
python1.ppt
 
gdscpython.pdf
gdscpython.pdfgdscpython.pdf
gdscpython.pdf
 
Python ppt
Python pptPython ppt
Python ppt
 
manish python.pptx
manish python.pptxmanish python.pptx
manish python.pptx
 
STRINGS IN PYTHON
STRINGS IN PYTHONSTRINGS IN PYTHON
STRINGS IN PYTHON
 

Dernier

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 

STRINGS_IN_PYTHON 9-12 (1).pptx

  • 1. PYTHON AND WEB DEVELOPMENT
  • 2. INSTRUCTIONS TO ATTENDEES Keep the microphone and camera off throughout the session Use hand raise option to acknowledge the host Post your answers in the chat box Any specific doubt related to content/problem kindly ask in the Q&A tab. A mentor will be allocated to clarify all your doubts which were posted in Q&A area.
  • 3. PREVIOUS SESSION DICTIONARIES AND SETS PROBLEM SOLVING ON DICTIONARIES AND SETS
  • 5. • A string is a sequence of characters.. • String literals in python are surrounded by either single quotation marks, or double quotation marks. INTRODUCTION h e l l o
  • 6. CREATING A STRING • Strings can be created by enclosing characters inside a single quote or double- quotes. • Anything given as input is basically considered as string.
  • 7. ACCESSING ELEMENTS IN A STRING Like list, string elements can also be accessed using indexing. 0 1 2 3 4 5 P Y T H O N -6 -5 -4 -3 -2 -1 indexing Negative indexing
  • 8. MODIFY A STRING • Strings are immutable, hence elements of a String cannot be changed once it has been assigned. • Only new strings can be reassigned to the same name.
  • 9. DELETE A STRING • We can directly delete a string using del keyword. • Delete a string using index is not possible.
  • 10. STRING METHODS AND FUNCTIONS • String.ascii_letters: Concatenation of the ascii_lowercase and ascii_uppercase constants. • string.ascii_lowercase: Concatenation of lowercase letters • string.ascii_uppercase: Concatenation of uppercase letters • string.punctuation: ASCII characters having punctuation characters.
  • 11. STRING METHODS AND FUNCTIONS • string.digits: Digit in strings • string.hexdigits: Hexadigit in strings • string.octdigits: Octadigit in a string
  • 12. STRING METHODS AND FUNCTIONS • string.endswith(): Returns True if a string ends with the given suffix otherwise returns False • string.startswith(): Returns True if a string starts with the given prefix otherwise returns False • replace(): returns a copy of the string where all occurrences of a substring is replaced with another substring.
  • 13. STRING METHODS AND FUNCTIONS • string.isdigit(): Returns “True” if all characters in the string are digits, Otherwise, It returns “False”. • string.isalpha(): Returns “True” if all characters in the string are alphabets, Otherwise, It returns “False”. • string.isdecimal(): Returns true if all characters in a string are decimal.
  • 14. STRING METHODS AND FUNCTIONS • string.isalnum(): Returns true if all the characters in a given string are alphanumeric. • string.istitle(): Returns True if the string is a titlecased string
  • 15. STRING METHODS AND FUNCTIONS • string.upper(): Returns the string with all uppercases. • string.lower(): Returns the string with all lowercases. • string.swapcase(): Method converts all uppercase characters to lowercase and vice versa of the given string, and returns it
  • 16. STRING METHODS AND FUNCTIONS • string.partition: splits the string at the first occurrence of the separator and returns a tuple. • string.index: Returns the position of the first occurrence of substring in a string. • string.rindex: Returns the highest index of the substring inside the string if substring is found. • string.splitlines: Returns a list of lines in the string.
  • 17. STRING METHODS AND FUNCTIONS • string.capitalize: Return a word with its first character capitalized. • string.find: Return the lowest index in a sub string. • string.rfind: find the highest index. • string.count: Return the number of (non-overlapping) occurrences of substring sub in string
  • 18. STRING METHODS AND FUNCTIONS • len(): Returns the length of the string. • max(): Returns the highest alphabetical character in a string. • min(): Returns the minimum alphabetical character in a string.
  • 19. SLICING A STRING S[:] – prints all the elements from the string. S[2:] – prints all the elements from the string starting from index 2 S[:5] – prints all the elements from the string till the ending index 4 S[2:6] – prints the elements from the string from index 2 till index 5 S[-4:-2] – prints the elements from the string from index -4 till index -3
  • 20. SLICING A STRING S[::2] – prints all the elements from the string with step 2 (index+2 element) from the beginning. S[::-1] – prints all the elements from the string with step 1 (index+1) from the last. S[1:6:3] – prints all the elements from the string from index 1 till index 5 with steps 3.
  • 21. GUESS THE OUTPUT ? Guess the correct output of the following String operations A)WelcomeWelcome B)TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’ a
  • 22. GUESS THE OUTPUT ? Select the correct output of the following String operations A)Welcome Coder B)WelcomCoder C)Welcom Coder D)WelcomeCoder c
  • 23. GUESS THE OUTPUT ? What is the output of the following code A)False True B)False False C)True False a
  • 24. METHOD String.ascii_letters: string.punctuation: replace(): string.isdecimal(): string.istitle: string.isalnum: string.rindex: string.partition: string.capitalize: DESCRIPTION returns a copy of the string where all occurrences of a substring is replaced with another substring. Returns True if the string is a titlecased string Concatenation of the ascii_lowercase and ascii_uppercase constants. splits the string at the first occurrence of the separator and returns a tuple. ASCII characters having punctuation characters. Returns true if all characters in a string are decimal. Returns true if all the characters in a given string are alphanumeric. Return a word with its first character capitalized. Returns the highest index of the substring inside the string if substring is found. MATCH THE METHOD WITH ITS DESCRIPTION
  • 25. METHOD String.ascii_letters: string.punctuation: replace(): string.isdecimal(): string.istitle: string.isalnum: string.rindex: string.partition: string.capitalize: MATCH THE METHOD WITH ITS DESCRIPTION DESCRIPTION returns a copy of the string where all occurrences of a substring is replaced with another substring. Returns True if the string is a titlecased string Concatenation of the ascii_lowercase and ascii_uppercase constants. splits the string at the first occurrence of the separator and returns a tuple. ASCII characters having punctuation characters. Returns true if all characters in a string are decimal. Returns true if all the characters in a given string are alphanumeric. Return a word with its first character capitalized. Returns the highest index of the substring inside the string if substring is found.
  • 27. PROBLEM STATEMENT 1 Write a Python program to calculate the length of a string. Input Format: Read a string. Output Format: Print the length of a string. Test cases: Sample Input Sample Output coder123 8 programming 11
  • 28. CODE
  • 29. PROBLEM STATEMENT 2 Write a Python script that takes input from the user and displays that input back in upper and lower cases. Input Format: Read a string Output Format: Print the string in both upper and lower case. Test Cases: Sample Input Sample Output talentio Your input in upper case TALENTIO Your input in lower case talentio python Your input in upper case PYTHON Your input in lower case python
  • 30. CODE
  • 31. PROBLEM STATEMENT 3 Write a Python program to swap cases of a given string. Input Format: Read a string. Output Format: Print the swapped cases of given string. Test Cases: Sample Input Sample Output CoDeR cOdEr tAlEnTiO TaLeNtIo
  • 32. CODE
  • 33. PROBLEM STATEMENT 4 Write a Python program to remove all consecutive duplicates from a given string. Input Format: Read a string. Output Format: Print the string after removing all consecutive duplicates. Test Cases: Sample Input Sample Output aabcsa "abcsa" pqqrrsrt "pqrsrt"
  • 34. CODE
  • 35. PROBLEM STATEMENT 5 Write a Python program to move all spaces to the front of a given string in single traversal. Input Format: Read a string. Output Format: Print the string after eliminating spaces. Test Cases: Sample Input Sample Output Python program " pythonprogram" try catch exception " trycatchexception"
  • 36. CODE
  • 37. PROBLEM STATEMENT 6 Write a Python program to create a string from two given strings concatenating uncommon characters of the said strings. Input Format: Read a string. Output Format: Print the new string. Test Cases: Sample Input Sample Output Talentio Solution TaSu Python Program ythngam
  • 38. CODE
  • 39. PROBLEM STATEMENT 7 Write a Python program to find the maximum occurring character in a given string. Input Format: Read a string. Output Format: Print the maximum occuring character. Test Cases: Sample Input Sample Output Treat t Tunnel n
  • 40. CODE
  • 41. PROBLEM STATEMENT 8 Write a Python program to check whether a string contains all letters of the alphabet. Input Format: Read a string. Output Format: Print whether the string contains all alphabets. Test Cases: Sample Input Sample Output The quick brown fox jumps over the lazy dog True Turn over False
  • 42. CODE
  • 43. PROBLEM STATEMENT 9 Write a Python program to convert a string in a list. Input Format: Read a string. Output Format: Print the list after converting the string to list. Test Cases: Sample Input Sample Output "python programmer" ["python" , "programmer"] Coding challenge ["Coding","challenge"]
  • 44. CODE
  • 45. PROBLEM STATEMENT 10 Write a Python program to remove the characters which have odd index values of a given string. Input Format: Read a string. Output Format: Print the string after removing odd characters. Test Cases: Sample Input Sample Output abcde "ace" player "pae"
  • 46. CODE
  • 48. ASSIGNMENT QUESTION 1 Write a Python function that takes a list of words and returns the length of the longest one. Input Format: Read the list of strings. Output Format: Print the length of longest word. Test Cases: Sample Input Sample Output ["talentio","coding","programmer "] 10 ["hello","Banglore"] 8
  • 49. ASSIGNMENT QUESTION 2 Write a Python program to capitalize first and last letters of each word of a given string. Input Format: Read the string. Output Format: Print the string after captalizing first and last letters in each word. Test Cases: Sample Input Sample Output programmer ProgrammeR coding CodinG
  • 50. SUMMARY STRINGS AND ITS BUILTIN FUNCTIONS AND METHODS PROBLEM SOLVING ON STRINGS
  • 53. POST TRAINING - DOUBTS OR Scan this QR code and say “Hi”
  • 54. KEEP WAITING FOR NEXT SESSION