write the program to display the number of vowels and consonants in the given string in python
Answers
Answer:
This python program allows the user to enter a string. Next, it counts the total number of vowels and consonants in this string using For Loop. First, we used Python For Loop to iterate each character in a String. Inside the For Loop, we are using If Statement to check the String character is a, e, i, o, u, A, E, I, O, U.
Explanation:
Please mark me as brainliest
Answer:
In this program, our task is to count the total number of vowels and consonants present in the given string. As we know that, The characters a, e, i, o, u are known as vowels in the English alphabet. Any character other than that is known as the consonant. To solve this problem, First of all, we need to convert every upper-case character in the string to lower-case so that the comparisons can be done with the lower-case vowels only not upper-case vowels, i.e.(A, E, I, O, U). Then, we have to traverse the string using a for or while loop and match each character with all the vowels, i.e., a, e, I, o, u. If the match is found, increase the value of count by 1 otherwise continue with the normal flow of the program. The algorithm of the program is given below.