My confusion is about the behavior of the slicing the string to make our pig latin translation. So with our entered word, why is it that we slice the string as follows:
instead of like so:
Take for example an 8 character string. Length of this string is 8. But since character positions in a string start at 0, our last character is at position 7. Why is it then that we are slicing our string to end at the length which is one greater than the position of the final character.
pyg = 'ay' original = raw_input('Enter a word:') if len(original) > 0 and original.isalpha(): print original else: print 'empty' word = original.lower() first = word new_word = word + first + pyg new_word = new_word[1:len(new_word)] print new_word