How to sort list only with name that starts with vowels?

Question:

Write a program that asks the user for a list of names and then outputs the names in alphabetical order, but only if the name starts with a vowel. Please help me to do this,i can do it with only one letter, but it doesn’t work with all vowels
Should look like this`
input:
john armin billie olivia eric
output:
[‘armin’, ‘eric’, ‘olivia’]

lst1 = [str(item) for item in input("Enter names separated by space  : ").split()]


print("The original list : " + str(lst1))

check = "aouie"
for i in lst1:
   if i[0].lower() == check.lower():
       lst1.sort()
print("The list of letter : " + lst1)

Asked By: Meline Gogjyan

||

Answers:

Use in to check if the name starts with any of the vowels.

vowel_names = [name for name in lst1 if name[0].lower() in "aeiou"]
print(sorted(vowel_names))
Answered By: Stuart
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.