1def vowel_count(string):
2 vowels = ['a', 'e', 'i', 'o', 'u']
3 return len([i for i in string if i in vowels])
1# Python Program to Count Vowels and Consonants in a String
2
3str1 = input("Please Enter Your Own String : ")
4vowels = 0
5consonants = 0
6
7for i in str1:
8 if(i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u'
9 or i == 'A' or i == 'E' or i == 'I' or i == 'O' or i == 'U'):
10 vowels = vowels + 1
11 else:
12 consonants = consonants + 1
13
14print("Total Number of Vowels in this String = ", vowels)
15print("Total Number of Consonants in this String = ", consonants)