Basic Programs

If Else Programs

While loop Programs

For loop Programs

List Programs


Python Program to Find if a Character is a Vowel or a Consonant


In this example shows, how to check the given string is Vowel or Not, Vowels are ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’. All other characters (‘b’, ‘c’, ‘d’, ‘f’ ….) are consonant.

Steps
  1. Get the input from user.
  2. Check the given character is vowel or consonant.
Here the Example Check the given character is vowel or consonant using if,else statement.
Example.py
c = str(input("Enter the Alphabet :"))

if c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u' or c == 'A' or c == 'E' or c == 'I' or c == 'O' or c == 'U':
    print(c, "is a vowel")  
else:
    print(c, "is a consonant")

Output 1

Enter the Alphabet : a
a is a vowel  

Output 2

Enter the Alphabet : h
h is a consonant

Prev Next