Slicing in python


#1

Hi
I am stuck with slicing in python pyglatin exercise. My code looks like this:

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

Now the error which is shown is: Oops, try again. It looks like you printed the correct translation of "kushal", but make sure to set new_word equal to the slice as well. Please help how to do that.
...


#2

Right now you're just printing the sliced version of new_word, but the exercise is asking you to assign the entirety of new_word to be the sliced version of itself

so try something like new_word = new_word[1:] right before your final print statement, and in the print statement simply call new_word rather than new_word[1:]


#3

Thanks a bunch for your reply shoelaces…worked like a charm!