Sep-21-2017, 09:57 AM
Objective is: to print True when it's a vowel, and False when it's a consonant, WITHOUT using if conditions.
Any help?
vowels = ['o', 'i', 'y', 'e', 'a','u'] consonants =['b, c, d, f, g, h, j, k, l, m ,n ,p, q, r, s, t, v, w, x, z'] def is_vowel(c): for character in vowels: print(True) for character in consonants: print(False) is_vowel('banana')Here's what I got when I executed the program:
True True True True True True FalseThis is obviously false because I should get False True False True False True.
Any help?