Ask Question
29 August, 19:35

Write a Python program to check whether an alphabet is a vowel or consonant.

+3
Answers (1)
  1. 29 August, 23:33
    0
    The program to this question an be given as:

    Program:

    char = input ("Enter any alphabet: ") #input alphabet from user in char variable.

    if char in ('a', 'e', 'i', 'o', 'u') : #check condition in if block.

    print ("vowel.") #print value.

    else: #else block

    print ("consonant.") #print value.

    Output:

    Enter any alphabet: r

    consonant.

    Explanation:

    In the above python program firstly we define a variable that is "char" it is used to take input from the user. for user input, we use the input function in the python.

    Then we define the conditional statement in this statement in if block we pass alphabets that is 'a', 'e', 'i', 'o', 'u' and check if user input alphabet and this alphabet match it will print vowel. otherwise, it will print consonant.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a Python program to check whether an alphabet is a vowel or consonant. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers