Python Program to check vowel or consonant
Python Program to check vowel or consonant
In this, we discuss how to check whether the entered character is vowel or consonant in Python Programming.
If you are new to Python Programming learn the following topics.
Introduction to Python
Basics of Python
Steps:
In this,the first step is ask user is asked to enter a character and the input character is stored in a variable. The program checks whether the entered character lies in the alphabets, if it does then the program displays the message that the “character is vowel” else it displays that the “character is consonant”.
Python code:
ch = input('enter any character:')
if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u') or (ch=='A' or ch=='E' or ch=='I' or ch=='O' or ch=='U'):
print('enter character is vowel')
else:
print('enter character is consonant')
Output:
Case 1: enter any character:a
enter character is vowel
Case 2: enter any character:r
enter character is consonant
Case 3: enter any character:A
enter character is vowel
Recommended Post:Program to check whether the number is prime
Plotting of even, odd, prime numbers
Subplot of even, odd and prime numbers from a list
Python Program to print Arithmetic Progress series
Program to find even and odd numbers from the list
Program to check whether a number is odd or even in Python