Set variable "new_word" equal to the slice as well?


I ain't know why it does accept my code without it can print correct ans? It tell me that i need to set variable "new_word" equal to the slice as well but i did not understand?? Please give me explanation in particular. Thanks much.

pyg = 'ay'
original = raw_input('Enter a word:')

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


At this point we no longer need to print original, so that line can be removed.

The next line can be assigned to back onto new_word and then print new_word.


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