I am working on the 10/11 slicing exercise for the PygLatin Translator. My code is the one in the image below, and I keep getting the error shown there:
I have moved forward by taking the action print new_word out from the if statement, and locating it after the else statement, as follows:
pyg = ‘ay’
original = raw_input('Enter a word: ')
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
But I do not understand why exactly I am getting an error with the first option: shouldn´t it work fine by having an action inside the if statement, before the else one?
Any comments are welcome!