mercredi 7 mars 2018

if statement vowel or consonant [duplicate]

This question already has an answer here:

I can't figure out why my code isn't working. I'm new at coding and am taking a uni/college course. I get an error message saying that my code output is 'vowel' for the print statement else print('consonant')

Here is my code -

def is_vowel(c):
return c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u'


char = input('Please enter a character: ')
if input == 'a' or 'e' or 'i' or 'o' or 'u':
    print('vowel')

else:
    print('consonant')

Aucun commentaire:

Enregistrer un commentaire