Count Vowels
Enter a string and the program counts the number of vowels in the text.
def count_vowels(string):
vowels = ['a','e','i','o','u','A','E','I','O','U']
count = 0
for char in string:
for vowel in vowels:
if char == vowel:
count +=1
print('Number of vowels in the given string is', count)
count_vowels('Hi')
def count_vowels(string):
vowels = ['a','e','i','o','u']
lower_string = string.lower()
count = 0
for char in lower_string:
for vowel in vowels:
if char == vowel:
count +=1
print('Number of vowels in the given string is', count)
count_vowels('HI')