Multiple 'or' Operators


I was getting a little off topic trying to make words starting with vowels work with the code. I used a bunch of or statements and in testing the only words starting with 'a' are marked as true. Why doesn't this work?
(the parentheses were added in debugging; didn't fix it)

Also is there (rather what is) a better way of doing this?

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    word = original.lower()
    first= word[0]
    if first == ("a" or ("e" or ("i" or ("o" or "u")))):
        new_word = word + "w" + pyg
        print new_word
        new_word = word[1:len(word)] + first + pyg
        print new_word

    print 'empty'


or returns the left side if the left side is truthy, otherwise it returns the right side.

This does not have the effect of comparing multiple expressions on the right side to the left side, the two sides are not compared to each other at all, and here you're trying to compare to something that isn't part of that expression at all (outside the parentheses)

condition1 or condition2

0 or 5        # 5, but this is probably not how you should use it
False or 'e'  # can you tell from the above example what this evaluates to?
'o' or 'u'


Ok I realized where I messed up.

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

This is what I was trying to do, but it is still tedious. is there a better way to do this?


Stick the values to compare to into some data structure and loop through it, comparing each one. Since it's single characters, a string is appropriate. For the looping part, there's the in-operator