0

Apologies for the bad formatting, it is my first post. I'm currently trying to return a list of words that begin with vowels from a given list, yet it is returning nothing. Is there a possibility for assistance?

x = ["A","B","C","D","E","F",]
wordList = []
for i in x:
  if i[0].lower() == ['a','e','i','o','u']:
    wordList.append(i)
return wordList

2 Answers2

1

Another way to do it:

x = ["A","B","C","D","E","F",]
wordList = [ i for i in x if i.lower().startswith(('a','e','i','o','u')) ]
Błotosmętek
  • 12,717
  • 19
  • 29
0
 x = ["A","B","C","D","E","F",]
 wordList = []
 for i in x:
     if i.lower() in ['a','e','i','o','u']:
         wordList.append(i)
 return wordList

try this.you will get letters that are vowels. for words beginning with vowels you can do the following.

 x = ["A","B","C","D","E","F",]
 wordList = []
 for i in x:
     if i[0].lower() in ['a','e','i','o','u']:
         wordList.append(i)
 return wordList

do up vote if liked.