In this simple python program, We need to check the given alphabet is a vowel or consonant. It's a beginner-level python program.
To understand this example, you should have knowledge of the following Python programming topics:
To solve this python program, we need to check the given input is a vowel and consonant. In the English language, some letters are known as vowels, which are 'a, e, i, o, u' or 'A, E, I, O, U', and all other letters are called consonants.
In python, we have to accept the input from the user using the input function and store that input in a variable. Then compare the user input with all these letters called vowels using a
If condition in python programming, and if it gets success, then print it as a vowel.
Else it will be a consonant.
STEP 1: Accept an input value from the user using the input function in the python program language.
STEP 2: Using an
if condition, compare the input value we accept from the user with " a, e, i, o, u" and "A, E, I, O, U" using an 'or' operator.
STEP 3: Print the value as a vowel if the condition gets true in python language using print.
STEP 4: Use
else to print the value as a consonant.
var = input("Enter any character in English: ") if(var=='A' or var=='a' or var=='E' or var =='e' or var=='I' or var=='i' or var=='O' or var=='o' or var=='U' or var=='u'): print(var, "The input value is a Vowel") else: print(var, "The input value is a Consonant")
Enter any character in English: A A The input value is a Vowel