pyPython Practice LabFrom first print to final round
TOPIC 06 OF 18

Strings and Text Processing Python practice problems

Indexing, slicing, searching, formatting, normalization, and character-by-character logic.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Reverse textCheck a phrase palindromeCount vowels and consonantsCount wordsCount a chosen characterRemove duplicate charactersCheck for anagramsFind the first nonrepeating character
REUSABLE THINKING

Problem-solving patterns

  • slice · string
  • normalization · palindrome
  • isalpha · counting
  • split · len
  • count · case sensitivity
PRACTICE OUTCOME

What this topic builds

Learn the idea once, use it across the exercises, and explain why your approach works.

ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #073
    Reverse text: Reverse a label

    Reverse a short product label for a string-slicing exercise.

    StarterPremium
  2. #074
    Reverse text: Keep spaces

    Reverse every character, including the space between two words.

    StarterPremium
  3. #075
    Check a phrase palindrome: Classic phrase

    Check a phrase that is a palindrome when spaces and case are ignored.

    StarterPremium
  4. #076
    Check a phrase palindrome: Punctuation and case

    Check a sentence containing punctuation and mixed capitalization.

    StarterPremium
  5. #077
    Count vowels and consonants: Course name

    Count the letter types in a short course title.

    BeginnerPremium
  6. #078
    Count vowels and consonants: Ignore digits and punctuation

    Ensure numbers and punctuation are not counted as consonants.

    BeginnerPremium
  7. #079
    Count words: Short sentence

    Count words in a normal sentence.

    BeginnerPremium
  8. #080
    Count words: Extra spacing

    Count correctly even when the user enters several spaces between words.

    BeginnerPremium
  9. #081
    Count a chosen character: Count a letter

    Count how often a letter appears in a fruit name.

    BeginnerPremium
  10. #082
    Count a chosen character: Case-sensitive count

    Observe that uppercase and lowercase characters are different.

    BeginnerPremium
  11. #083
    Remove duplicate characters: Compress repeated letters

    Keep only the first appearance of each character in a word.

    BeginnerPremium
  12. #084
    Remove duplicate characters: Spaces are characters

    Preserve the first space while removing later repeated characters.

    IntermediatePremium
  13. #085
    Check for anagrams: Simple anagram

    Check two short words made from the same letters.

    IntermediatePremium
  14. #086
    Check for anagrams: Phrase anagram

    Ignore spaces and case when comparing two phrases.

    IntermediatePremium
  15. #087
    Find the first nonrepeating character: Unique letter exists

    Find the earliest character that appears only once.

    IntermediatePremium
  16. #088
    Find the first nonrepeating character: No unique letter

    Return None when every character repeats.

    IntermediatePremium
  17. #089
    Run-length encode text: Repeated groups

    Encode a compact sensor status string with repeated runs.

    IntermediatePremium
  18. #090
    Run-length encode text: No repeated neighbors

    Encode a string where every run has length one.

    AdvancedPremium
  19. #091
    Find the longest word: Course description

    Find the longest word in a brief course description.

    AdvancedPremium
  20. #092
    Find the longest word: Tie behavior

    When two words tie, return the first one encountered.

    AdvancedPremium