Python String Count of Vowels and Consonants || String Manipulation || Python

In this we are going to see about Python String Count of Vowels and Consonants in Python Programming Language.

def count_vowels_and_consonants():
    str1 = "help for coders"
    vowels = 0
    consonants = 0
    for i in str1:
        if i in "aeiou":
            vowels += 1
        elif i in "bcdfghjklmnpqrstvwxyz":
            consonants += 1
    print("Vowels: %d" % vowels)
    print("Consonants: %d" % consonants)

count_vowels_and_consonants()

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post