Â
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 3 of Functions in Python Programming Language.
def count_vowel_consonant():
str = "Help For Coders"
vowel = 0
consonant = 0
for i in str:
if i.isalpha():
if i.lower() in "aeiou":
vowel = vowel + 1
else:
consonant = consonant + 1
return vowel, consonant
v, c = count_vowel_consonant()
print("Vowels : ", v, " Consonants : ", c)
# Coded by Saahil Shaikh
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP