Checking multiple values for a variable [duplicate]

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = str(word)[0]
    print first
    if str(first) == "a" or "e" or "i" or "u" or "o":
        print "vowel"
else:
    print "consonant"

I want to check if a word starts with a vowel or consonant. However, this part does not work: if str(first) == "a" or "e" or "i" or "u" or "o"

So how would you check if the first letter is either "a" or "e" or "i" or "u" or "o"?


You better use in

    if len(original) and original.isalpha():
        word = original.lower()
        first = word[0]
        print first
        if first in ('a','e','i','o','u'):
            print "vowel"
        else:
            print "consonant"

also you are doing it wrong, if you are trying to use OR clause you must use like this BUT it's not the better pythonic way:

 if first =='a' or first =='e' or first =='i' or first =='o' or first =='u':

if str(first) == "a" or "e" or "i" or "u" or "o":

should moditied to

if str(first) in ("a", "e", "i", "o", "u"):

Python has a explicit demand on indent. Make sure you have a right indent.

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first = str(word)[0]
    print first
    if str(first) in ("a", "e", "i", "o", "u"):
        print "vowel"
    else:
        print "consonant"