← go back

solving random problems in python is fun, but i need more challenging things than this:

def count_vowels(string):
    vowels = ["a", "e", "i", "o", "u"]
    vowel_c = 0
    
    for char in string:
        if char.lower() in vowels:
            vowel_c += 1
            
    return vowel_c
    
print(count_vowels("Counting vowels!"))
Dec 12, 2023, 4:48 PM
4 0 2

Comments