PygLatin : Correct word printed but wrong code?


pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    print original
    word = original.lower()

    print 'empty'
first = word[0]
new_word = word+first+pyg
print new_word[1:len(new_word)]

It looks like you printed the correct translation of "anjney", but make sure to set new_word equal to the slice as well.your code.


Hi, @valord ,

You need to assign the final slice that represents the solution to new_word, then display the value of new_word.


Mind to copy and correct my code and comment it??


Instead of this ...

print new_word[1:len(new_word)]

... you should first assign the slice to new_word, as follows ...

new_word = new_word[1:len(new_word)]

... or like this ...

new_word = new_word[1:]

Then, display it ...

print new_word


Thank you very much!