Write a Python function to Count and print the Number of Vowels Present in a String using Sets


Topic: Write a Python function to Count and print the Number of Vowels Present in a String using Sets

Solution

def count_vowels(s):
    count = 0
    vowels = set("aeiou")
    for letter in s:
        if letter in vowels:
            count += 1
    return count



List all Python Programs