well first of all i cant figure out how to move the first letter to the end
but before i fix that i need help figuring out why the else branch is being totally ignored. even when the conditions are met for else It still gives me the result in the if branch

pyg = 'ay'

original = raw_input('Enter a word')
word=original
first=word[0]
new_word=original[1:]

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

The reason it isn't working is because the condition in the if: statement is incorrect. When you write

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

... what it is really saying is

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

That is to say, it only compares the value of first to "a"; the rest of the clauses all evaluate to True, so the the whole condition will always be True.

In order to compare a single value against several values, you need to use a list and a set membership (in or not in) operator:

    if first in ["a", "e", "i", "o", "u"]:

Note that you also aren't handling the case of uppercase values, but that's a complication you can handle on your own, I think.

Thank you, your solution worked :D
oh i didnt notice i didnt hadle the upper case values, thanks for pointing that out too :)

You could avoid upper case letters with
original = raw_input('Enter a word: ').lower()

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.