Python program to take a character and tells its vowel or consonant

Views: 137   

Following program shows you how to take a character and tells its vowel or consonant.
In this program we get a character from user and shows it's vowel or consonant using if condition

char = input("Enter a character:")
if (char == 'a' or char == 'A' or char == 'e' or char == 'E' or char == 'i'
        or char == 'I' or char == 'o' or char == 'O' or char == 'u'
        or char == 'U'):
    print('Its a vowel')
else:
    print('Its a consonant')

Output:

Example1:

Enter a character: u
Its a vowel

Example2:

Enter a character: s
Its a consonant
On By