Question: Easy Question #5 Create a function vowel_or_cons that takes in a letter of the alphabet. If the letter is a, e, i, o or u,
Easy Question #5
Create a function vowel_or_cons that takes in a letter of the alphabet. If the letter is a, e, i, o or u, then your function should return the string 'vowel'. If the letter is y then your function should return the string 'vowel or consonant'. Otherwise your function should return the string 'consonant'.
For example:
vowel_or_cons('a') # 'vowel'
vowel_or_cons('y') # 'vowel or consonant'
vowel_or_cons('h') # 'consonant'
what I have so far:
l = input('Input a letter: ') def vowel_or_cons(l): if l in ('a', 'e', 'i', 'o', 'u'): print('vowel') elif l == 'y': print('vowel or consonant') else: print('consonant') vowel_or_cons(l)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
