#10 Ending Syntax Error - check the code pls


I am stuck on exercise 10 of the PygLatin. For reason the code below gives me syntax error. Am I not allowed to colons (:slight_smile: to splice the word ? atleast thats what the error tells me syntax error on the colon line . Help would be appreciated. Thanks.
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**
** new_word = [1:len(new_word)]**
** new_word = [1:5]**
** print "new_word"**
** print 'empty'**


That is because of this statement. You are missing something in your equal statement. Because you see you can't just equal new word to the slice but you have to equal it to the slice of the what? Sorry if that is confusing. I can try explaining that in a different light if need be.


THANKS a bunch I got it !!!


Haha no problem! :smiley: Glad to have been of service!


So, I am having the exact same issue on the same line and i've tried googling but i'm not getting it. Would you mind breaking it down for me?


@microsurfer25839, Let me give it a shot at trying to explain it to you:

new_word = [1:len(new_word)] doesn't work because you have to define which string you would like to manipulate. In this case, we need to manipulate "new_word" from line 1 of this image. This is how this should look:

On the second line of this image, the left side of the function, is where we store "new" new_word. On the right side, we are telling the compiler return the "new_word" from line 1, beginning at character 1 (second letter in the string because we always start counting from zero) all the way to the end of the string (which we know by using length function).

Does that help out?


Yes! it makes obvious sense now that i would have to tell the computer where to pull the information from! Thank you for making it so easy to understand!


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