Write a program to count Vowels and Consonants in string.
def IsVowel(ch):
return (ch.lower() in ['a', 'e', 'i', 'o', 'u'])
source = input()
vowels = 0
consonants = 0
for ch in source:
if(ch.isalpha()):
if(IsVowel(ch)):
vowels += 1
else:
consonants += 1
print('The number of vowels is', vowels)
print('The number of consonants is', consonants)
Comments
Leave a comment