[go: up one dir, main page]

0% found this document useful (0 votes)
21 views3 pages

String Exercise

The document provides a collection of string manipulation tasks, including reversing strings, checking for palindromes, counting vowels, and converting cases. It also covers advanced operations like finding anagrams, extracting numbers, and validating email formats. Additionally, it offers options for solutions, worksheets, or grouping tasks by difficulty levels.

Uploaded by

ninaize123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

String Exercise

The document provides a collection of string manipulation tasks, including reversing strings, checking for palindromes, counting vowels, and converting cases. It also covers advanced operations like finding anagrams, extracting numbers, and validating email formats. Additionally, it offers options for solutions, worksheets, or grouping tasks by difficulty levels.

Uploaded by

ninaize123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Reverse a String​

Input: "hello" → Output: "olleh"​

Check for Palindrome​


Input: "racecar" → Output: True​

Count Vowels in a String​


Input: "education" → Output: 5​

Convert to Uppercase​
Input: "python" → Output: "PYTHON"​

Find the Longest Word in a Sentence​


Input: "The quick brown fox" → Output: "quick"​

Replace All Spaces with Hyphens​


Input: "data science" → Output: "data-science"​

Check if Two Strings Are Anagrams​


Input: "listen", "silent" → Output: True​

Count the Number of Words in a Sentence​


Input: "Hello world program" → Output: 3​

Remove All Digits from a String​


Input: "abc123xyz" → Output: "abcxyz"​

Capitalize the First Letter of Each Word​


Input: "machine learning" → Output: "Machine Learning"

Find All Duplicated Characters​


Input: "programming" → Output: ['r', 'g', 'm']​

Check if a String is a Pangram (contains every letter a-z)​


Input: "The quick brown fox jumps over the lazy dog" → Output: True​

Count Frequency of Each Character​


Input: "hello" → Output: {'h': 1, 'e': 1, 'l': 2, 'o': 1}​
Extract All Numbers from a String​
Input: "Order123 confirmed for 2 items" → Output: [123, 2]​

Remove All Punctuation from a String​


Input: "Hello, world!" → Output: "Hello world"​

Compress a String (Run-Length Encoding)​


Input: "aaabbc" → Output: "a3b2c1"​

Find First Non-Repeating Character​


Input: "aabbccde" → Output: "d"​

Find the Most Frequent Word in a Paragraph​


Input: "apple orange apple banana" → Output: "apple"​

Validate Email Format​


Input: "test@example.com" → Output: True​

Check if a String Ends with Another​


Input: "machine", "ine" → Output: True

Convert Snake Case to Camel Case​


Input: "machine_learning_model" → Output: "machineLearningModel"​

Check if a String is a Subsequence of Another​


Input: "abc", "aebdc" → Output: True​

Group Anagrams from a List of Strings​


Input: ["bat", "tab", "cat", "act"] → Output: [['bat', 'tab'],
['cat', 'act']]​

Split a String into Chunks of Size N​


Input: "abcdefgh", n=3 → Output: ['abc', 'def', 'gh']​
21.​ Find All Palindromic Substrings in a String​
Input: "abba" → Output: ["a", "b", "b", "a", "bb", "abba"]​

Let me know if you'd like solutions, PDF worksheet, or to group them


into levels (Beginner, Intermediate, Advanced).

Ask ChatGPT

You might also like