Vowel or Consonant

Write a Python program that reads a letter of the alphabet from the user and checks whether it is a vowel or a consonant.

Example 1:

Input: "a"

Output: "Vowel"

Example 2:

Input: "z"

Output: "Consonant"

Consider that vowels are ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’. Anything else is a consonant.

def check_vowel_or_consonant(letter):
    vowels = ['a', 'e', 'i', 'o', 'u']
    if letter.lower() in vowels:
        return "Vowel"
    else:
        return "Consonant"

© Let’s Data Science

LOGIN

Unlock AI & Data Science treasures. Log in!