Python program to extract names starting with vowels
4. Vowel Name Filter
Write a Python program that creates a list of names and uses the filter function to extract names that start with a vowel (A, E, I, O, U).
Sample Solution:
Python Code:
Explanation:
In the exercise above -
- Start with a list of names called "names".
- Define a function called "starts_with_vowel()" that checks if the first letter of a name (converted to lowercase) is in the list of vowels.
- Next we use the filter function to filter the names from the names list based on the conditions defined by the "starts_with_vowel()" function.
- The filtered names are converted to a list, and we print the extracted names.
Sample Output:
Original list of names: ['Elita', 'Vitold', 'Audovacar', 'Kerensa', 'Ramana', 'Iolanda', 'Landyn'] Extract names starting with a vowel: ['Elita', 'Audovacar', 'Iolanda']
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to filter a list of names, extracting only those that start with a vowel and end with a consonant.
- Write a Python function that uses the filter function to select names starting with a vowel from a list and then convert the selected names to uppercase.
- Write a Python program that filters out names not starting with a vowel and then sorts the resulting list by the length of each name.
- Write a Python program to filter a list of names to extract those that start with a vowel and have at least six characters.
Go to:
Previous: Python function to filter numbers by threshold.
Next: Python function to filter out empty strings from a list.
Python Code Editor:
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.