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"
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.