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 1 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
print("Vowels : ", vowel, "Consonants : ", consonant)
count_vowel_consonant()
# Coded By DHIRAJ SHELKE
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP