.WAP to accept a character from the user and display whether it is a vowel or
consonant.
Answers
Answered by
6
import string
tmp_vowels = ["a", "e", "i", "o", "u"]
vowels = tmp_vowels[:]
for x in tmp_vowels:
vowels.append(x.upper())
alphabets = [*list(string.ascii_lowercase), *list(string.ascii_uppercase)]
consonants = [x for x in alphabets if x not in vowels]
c = input("character: ")
if c in vowels:
print("tis a vowel!")
if c in consonants:
print("tis a consonant!")
Similar questions