# 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