Translates the previously entered word, not the current one


When re-running my code if I change the word then it gives me the translation for the previous word. If I then run it again with the same word it will come out correctly translated. So basically I have to run the same word twice to get the correct translation. Or, put another way. it is translating the last word instead of the current one.

Any ideas what I did wrong?

pyg = 'ay'
new_word = word + first + pyg
new_word = new_word[1:]

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    print original
    word = original.lower()
    first = word[0]
    print new_word
    print 'empty'


Those lines should be inside the if statement, just above the print new_word.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.