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

Using insertAdjacentHTML instead of innerHTML to avoid XSS attacks

Quotation marks to wrap an element in HTML

Various Types of Computer Architectures