Â
In this we are going to see a basic example about a Function that Counts the no. of Vowels and Consonants in a String in Python - Type 4 of Functions in Python Programming Language.
def count_vowel_consonant(str):
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
x = count_vowel_consonant("Help For Coders")
print("Vowels : ", x[0])
print("Consonants : ", x[1])
# Coded By DHIRAJ SHELKE
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP