In this post, we will make a python program that checks the number of vowels and consonants in the given sentences.
To check the number of vowels in a sentence then we have followed the following steps:
- So, First, we have to take input from the user, so, we use the input() function.
- Now, first, we convert all the letters into lower case.
- And then we make 2 variables vowels and consonants and set them to 0.
- And now, we make a list that contains all the vowels such as a, e, i, o, u.
- And then we iterate the string that was input by the user.
- Now, we check the letters of the strings are equal to the vowels that contain sin lists, if they are equal then we update the vowels to plus+1.
- Otherwise, we update the consonant to plus 1.