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.

Example:

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.")
else:
print(f"'{ch}' is a consonant.")

© Let’s Data Science

LOGIN

Unlock AI & Data Science treasures. Log in!