dimanche 10 octobre 2021

Identify if a word in a list starts with a vowel

I need to identify if these words start with a vowel or not.

year= ["january","february","march","april","may","june","july","august","september","october","november","december"]
vowels = "aeiou"

for month in range(len(year)):
    if month.startswith(vowels):
         if_vowel = "Yes"
    else:
         if_vowel = "No"
print("Does the month of {0} start with a vowel? {1}".format(year[i],if_vowel)

Ideally,it would print Yes or No depending if the month starts with a vowel

Aucun commentaire:

Enregistrer un commentaire