Following code will identify that entered character is a vowel or consonant.
Code::
def vowel(str):
if(str=='a' or str=='e' or str=='i' or str=='o' or str=='u' or str=='A' or str=='E' or str=='I' or str=='O' or str=='U'):
print("Vowel")
else:
print("Consonant")
while True: #for only one character
a=input("Enter a Character: ")
if(len(a)==1):
break
else:
print("Try Again!!")
continue
vowel(a)
Output:
Code::
def vowel(str):
if(str=='a' or str=='e' or str=='i' or str=='o' or str=='u' or str=='A' or str=='E' or str=='I' or str=='O' or str=='U'):
print("Vowel")
else:
print("Consonant")
while True: #for only one character
a=input("Enter a Character: ")
if(len(a)==1):
break
else:
print("Try Again!!")
continue
vowel(a)
Output: