write a Python program to check whether the character is vowel or not
Answers
Answer:
ch = input("Enter a character: ")
if(ch=='A' or ch=='a' or ch=='E' or ch =='e' or ch=='I'
or ch=='i' or ch=='O' or ch=='o' or ch=='U' or ch=='u'):
print(ch, "is a Vowel")
else:
print(ch, "is a Consonant")
The following codes will have to be typed in script mode, saved and then executed.
Here, we'll be using the IF - ELSE function. It is a function that decides the result based on a given condition.
It will run the body of the code, only if the condition is true. Otherwise, the 'else' code of the value inputted will be executed.
CODE:
x = input("Enter a character:")
if x == "a" or x == "e" or x == "i" or x == "o" or x== "u" or x == "A" or x == "E" or x == "I" or x == "O" or x == "U":
print("The character entered is a vowel.")
else:
print("The character entered is a consonant.")
OUTPUT: