In this tutorial we are going to learn writing python program to check given character is a vowel ( a, e, i, o, u) or any other alphabet other than vowels(consonant) .
For any input character, we have to check whether a character is a vowel or consonant.
Case 1: If a user is given input a or A
The output should be “Vowel”
As we know that A is a vowel
Case2: If the user is given b or B
The output should be “consonant”
As we know that B is consonant
Our logic to check given character is vowel or consonant
- Our program will take any character as an input from the user
- Then checks if the character taken belongs to vowels or consonants, we achieve this using if-else conditional statements.
Algorithm to check given character is vowel or consonant
Step2 Take input from the user
Step3 Apply if-else condition,
Step4 : Stop
Python code to check given character is vowel or consonant
As we can see for the character ‘o’ output generated is “Vowel”, which is obvious as o is a vowel and satisfying the ‘if ’ statement
Similarly, for the character ‘S’ output generated is “consonant”, as S is not a vowel and does not satisfy the ‘if ’ statement