Ask Question

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

+5
Answers (1)
  1. 10 April, 14:24
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers