Vowel or Consonant

Given a character, write a program that checks if the character is a vowel or consonant. Print an appropriate message to the console.


Input: a 

Output: 'a' is a vowel.

You can create a list of vowels and then check if the given character is in the list.

ch = input("Enter a character: ")

if ch.lower() in ['a', 'e', 'i', 'o', 'u']:
print(f"'{ch}' is a vowel.")
print(f"'{ch}' is a consonant.")

© Let’s Data Science


Unlock AI & Data Science treasures. Log in!