Ask Question
20 July, 20:21

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

+3
Answers (1)
  1. 21 July, 00:05
    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?
Find an answer to your question ✅ “Write a Python program to check whether an alphabet is a vowel or consonant. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers