Â
In this we are going to see how to build a function to That Counts the No. of Vowels and Consonants in a String - Type 2 of Functions in Python Programming Language.
def count_vowel_consonant():
vowel = 0
consonant = 0
for i in str:
if i.isalpha():
if i.lower() in "aeiou":
vowel = vowel + 1
else:
consonant = consonant + 1
print("Vowels : ", vowel, "Consonants : ", consonant)
str = "Help For Coders"
count_vowel_consonant()
# Coded By Ashish
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP