Questions

Is vowel Function in Python? 

Method 1:

Users can use built-in functions to check whether an alphabet is vowel function in python or not.

Algorithm:

Step 1: Get the input from the user as a ccharacter

Step 2: Using built-in python functions like (lower(), upper()), determine whether the input is vowel or consonant.

Step 3: If the character is a vowel, it should be printed. Otherwise, print Consonant if you don’t have a vowel.

Step 4: End

Source Code:

                    

l = input("Enter the character: ")

if l.lower() in ('a', 'e', 'i', 'o', 'u'):

  print("Vowel")

elif l.upper() in ('A', 'E', 'I', 'O', 'U'):

  print("Vowel")

else:

  print("Consonant")

Output:

Enter the character

e 

Vowel

Method 2: Using the logical operator

                    

ch = input("Enter the character : ")

if(ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u' or ch == 'A' or ch == 'E' or ch == 'I' or ch == 'O' or ch == 'U'):

  print("Vowel")

else:

  print("Consonant")

Output:

Enter the character:

M

Consonant

Related Questions

Share with friends

Customize your course in 30 seconds

Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
tutor
tutor
Ashhar Firdausi
IIT Roorkee
Biology
tutor
tutor
Dr. Nazma Shaik
VTU
Chemistry
tutor
tutor
Gaurav Tiwari
APJAKTU
Physics
Get Started

Leave a Reply

avatar
  Subscribe  
Notify of

Customize your course in 30 seconds

Which class are you in?
No thanks.