Strings and Text Processing Python practice problems
Indexing, slicing, searching, formatting, normalization, and character-by-character logic.
Core concepts
Problem-solving patterns
- slice · string
- normalization · palindrome
- isalpha · counting
- split · len
- count · case sensitivity
What this topic builds
Learn the idea once, use it across the exercises, and explain why your approach works.
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #073Reverse text: Reverse a labelStarterPremium
Reverse a short product label for a string-slicing exercise.
- #074Reverse text: Keep spacesStarterPremium
Reverse every character, including the space between two words.
- #075Check a phrase palindrome: Classic phraseStarterPremium
Check a phrase that is a palindrome when spaces and case are ignored.
- #076Check a phrase palindrome: Punctuation and caseStarterPremium
Check a sentence containing punctuation and mixed capitalization.
- #077Count vowels and consonants: Course nameBeginnerPremium
Count the letter types in a short course title.
- #078Count vowels and consonants: Ignore digits and punctuationBeginnerPremium
Ensure numbers and punctuation are not counted as consonants.
- #079Count words: Short sentenceBeginnerPremium
Count words in a normal sentence.
- #080Count words: Extra spacingBeginnerPremium
Count correctly even when the user enters several spaces between words.
- #081Count a chosen character: Count a letterBeginnerPremium
Count how often a letter appears in a fruit name.
- #082Count a chosen character: Case-sensitive countBeginnerPremium
Observe that uppercase and lowercase characters are different.
- #083Remove duplicate characters: Compress repeated lettersBeginnerPremium
Keep only the first appearance of each character in a word.
- #084Remove duplicate characters: Spaces are charactersIntermediatePremium
Preserve the first space while removing later repeated characters.
- #085Check for anagrams: Simple anagramIntermediatePremium
Check two short words made from the same letters.
- #086Check for anagrams: Phrase anagramIntermediatePremium
Ignore spaces and case when comparing two phrases.
- #087Find the first nonrepeating character: Unique letter existsIntermediatePremium
Find the earliest character that appears only once.
- #088Find the first nonrepeating character: No unique letterIntermediatePremium
Return None when every character repeats.
- #089Run-length encode text: Repeated groupsIntermediatePremium
Encode a compact sensor status string with repeated runs.
- #090Run-length encode text: No repeated neighborsAdvancedPremium
Encode a string where every run has length one.
- #091Find the longest word: Course descriptionAdvancedPremium
Find the longest word in a brief course description.
- #092Find the longest word: Tie behaviorAdvancedPremium
When two words tie, return the first one encountered.