To check whether the input character is a vowel or not in python, you have to ask from user to enter a character to check whether that character is a vowel or not as shown in the program given below.
Following python program ask from user to enter any character to find whether it is a vowel or not:
# Python Program - Check Vowel or Not print("Enter '0' for exit."); ch = input("Enter any character: "); if ch == '0': exit(); else: 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 not a vowel.");
Here is the sample run of the above Python program demonstrating how to check for vowel:
Initial output of the above program is given in the below screenshot, asking from user to enter any character to check it out:
Now type anything say e as input and press enter to check whether it is a vowel or not. As e is a vowel, therefore here is the output you will see:
Now let's re-run the above program, and check for not vowel just by entering any other character other than vowel, that is a, e, i, o, u.
Here is the same program written and run directly on python shell:
Program Video with Compile and Run
You may also like to learn or practice the same program in other popular programming languages: