Skip to main content

Python Program to Check whether a character is a Vowel or Consonant

 

               

Python Program to Check whether a character is a Vowel or Consonant


  In this we are going to learn given character is vowel or Consonant. Generally there are 5 vowels they are a,e,i,o,u and remaining are the consonants in alphabets of 26. we can write this program by using strings. string is a collection of characters. 

     Input:

      k
   Output: 
        Consonant
       
     Explanation 

        vowels={a,e,i,o,u,A,E,I,O,U}
        if input character in the above list then vowels, else consonant
        

      Code:

       r=input()      # input string
       s="aeiou"     # string contains vowels
       r=r.lower()   
       if r in s:        
           print("Vowel")  
       else:
           print("Consonant")      


Note:
    Hello Guys, Don't Stop Learning keep Going..............