QUESTION IMAGE
Question
item 4
10 points
alphabet category
by codechum admin
write a program that takes a character
character as input and checks whether the
character is a vowel or consonant. if the
character is one of the vowels (a, e, i, o, u
or their uppercase variants), print \the
character is a vowel.\; otherwise, print \the
character is a consonant.\
sample output 1
enter a character: a
the character is a vowel.
sample output 2
enter a character: b
the character is a consonant.
sample output 3
enter a character: a
the character is a vowel.
Step1: Get user input
char = input("Enter a character: ")
Step2: Convert to lowercase
char_lower = char.lower()
Step3: Check if vowel
if char_lower in ['a', 'e', 'i', 'o', 'u']:
print("The character is a vowel.")
Step4: Else consonant
else:
print("The character is a consonant.")Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
char = input("Enter a character: ")
char_lower = char.lower()
if char_lower in ['a', 'e', 'i', 'o', 'u']:
print("The character is a vowel.")
else:
print("The character is a consonant.")