Function in Python that counts the number of vowels in a string




vowels = []
def vowelscount(string):
    if "a" in string:
        vowels.append("a")
    if "e" in string:
        vowels.append("e")
    if "i" in string:
        vowels.append("i")
    if "o" in string:
        vowels.append("o")
    if "u" in string:
        vowels.append("u")
    return len(vowels)
       
print(vowelscount("aeiouaeiou"))



Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

Making GUI Calculator in Tkinter Python

Unlocking Web Design: A Guide to Mastering CSS Layout Modes