asked 9.6k views
0 votes
Write a Python program to check whether an alphabet is a vowel or consonant.


asked
User Skmvasu
by
7.6k points

1 Answer

1 vote

Answer:

The program to this question an be given as:

Program:

char = input("Enter any alphabet: ") #input alphabet from user in char variable.

if char in ('a', 'e', 'i', 'o', 'u'): #check condition in if block.

print("vowel.") #print value.

else: #else block

print("consonant.") #print value.

Output:

Enter any alphabet: r

consonant.

Explanation:

In the above python program firstly we define a variable that is "char" it is used to take input from the user. for user input, we use the input function in the python.

Then we define the conditional statement in this statement in if block we pass alphabets that is 'a', 'e', 'i', 'o', 'u' and check if user input alphabet and this alphabet match it will print vowel. otherwise, it will print consonant.

answered
User HowlingFantods
by
7.3k points
Welcome to Qamnty — a place to ask, share, and grow together. Join our community and get real answers from real people.