Program to count the number of vowels in a string

# Count Vowels in a String
string = input("Enter a string: ")
vowels = 'aeiouAEIOU'
count = sum(1 for char in string if char in vowels)
print("Number of vowels in the string:", count)
Output:
Enter a string: Hello World
Number of vowels in the string: 3

Leave a Reply

Your email address will not be published. Required fields are marked *