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

What is the difference between iostream and iostream.h in cpp?

The Basic Structure of a Full-Stack Web App