Iterate An Ifelse Over A List

Want to learn more? I recommend these Python books: Python for Data Analysis, Python Data Science Handbook, and Introduction to Machine Learning with Python.

Create some data

word_list = ['Egypt', 'Watching', 'Eleanor']

vowels = ['A', 'E', 'I', 'O', 'U']

Create a for loop

# for each item in the word_list,
for word in word_list:
    # if any word starts with e, where e is vowels,
    if any([word.startswith(e) for e in vowels]):
        # then print is valid,
        print('Is valid')
    # if not,    
        # print invalid
Is valid
Is valid