Python program to check whether an alphabet is a vowel or consonant

code:-

str = input("Input a letter of the alphabet: ")
 
if str in ('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U', 'A', 'E'):
    print("%s is a vowel." % str)
else:
    print("%s is a consonant." % str) 

output:-

Input a letter of the alphabet: a

a is a vowel.

>>> 

Input a letter of the alphabet: b

b is a consonant.

>>> 

1 Comments

If you have any doubts, Please let me know
Thanks!

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post