Python Program to Check Vowel or Consonant-Python Programs

Python Program to Check Vowel or Consonant

In this session, we are going to discuss about a Python program to check whether the entered character is vowel or consonant. In this program checks whether the entered character is equal to the lowercase or uppercase vowels, if it is then the program prints a message saying that the character is a Vowel else it prints that the character is a Consonant. Before starting this program beginners should know why do we learn Python?

Why do we  Learn Python?

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages. Python is a must for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. 


Program checks whether the entered character is equal to the lowercase or uppercase vowels, if it is then the program prints a message saying that the character is a Vowel else it prints that the character is a Consonant.

Program Code

 # getting user input
ch = input("Enter a character: ")
if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I'
 or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
    print(ch, "is a Vowel")
else:
    print(ch, "is a Consonant")
    

Output 1

Enter a character: X
X is a Consonant

Output 2

Enter a character: A
A is a Vowel

And also Check. 

Post a Comment

If you any doubts, Please let me know

Previous Post Next Post