Python: Find the vowels from each of the original texts (y counts as a vowel at the end of the word)
Extract Vowels with Y as Vowel
Write a Python program to find the vowels from each of the original texts (y counts as a vowel at the end of the word) from a given list of strings.
Input: ['w3resource', 'Python', 'Java', 'C++'] Output: ['eoue', 'o', 'aa', ''] Input: ['ably', 'abruptly', 'abecedary', 'apparently', 'acknowledgedly'] Output: ['ay', 'auy', 'aeeay', 'aaey', 'aoeey']
Visual Presentation:
Sample Solution:
Python Code:
Sample Output:
Original List of strings: ['w3resource', 'Python', 'Java', 'C++'] Vowels from each of the original texts (y counts as a vowel at the end of the word: ['eoue', 'o', 'aa', ''] Original List of strings: ['ably', 'abruptly', 'abecedary', 'apparently', 'acknowledgedly'] Positions of all uppercase vowels (not counting Y) in even indices: ['ay', 'auy', 'aeeay', 'aaey', 'aoeey']
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Python program to extract vowels from each word in a list, treating 'y' as a vowel only if it appears at the end of the word.
- Write a Python program to iterate over words and return a list of vowel-only strings based on the special rule for 'y'.
- Write a Python program to use regular expressions to capture vowels in each word, counting 'y' as a vowel when at the word’s end.
- Write a Python program to process a list of words and output the concatenated vowels from each word, applying the 'y' rule.
Go to:
Previous: Find an increasing sequence consisting of the elements of the original list.
Next: Find a valid substring of s that contains matching brackets, at least one of which is nested.
Python Code Editor :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.