Python Program to Check Whether a Character is a Vowel or Consonant
In the English language, the letters A, E, I, O, U and a, e, i, o, u are defined as a vowel. Except these all other letters are consonants. We can write a c program to check vowels or consonants using an if-else statement or by using switch-case statements.
Python Program to Check Whether a Characterch = input("Enter an Alphabet: ")
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(ch, "is a Vowel")
else:
print(ch, "is a Consonant")
Enter an Alphabet: E
E is a Vowel.
Enter an Alphabet: S
S is a Consonant.
Run Code: If you want run this code copy this code, paste here and run.
No comments: