10. Ending Up - What does this SyntaxError mean?


#1

After running this code:


pyg = 'ay'

original = raw_input('Enter a word:')

word=original.lower()

first=word[0]

new_word=word + first + pyg

new_word=[1:len(new_word)]

if len(original) > 0 and original.isalpha():
print new_word
else:
print 'empty'


I get this error:


File "python", line 11
new_word=[1:len(new_word)]
^
SyntaxError: invalid syntax


I can't figure out what the deal is. Any and all help is appreciated. Thanks!


#2

@acevmj10: Whenever we want to use string slicing, it should be like this:

yourStringName[numberStart:numberEnds]

But doing this won't change your string, since they're immutable so assign that into another variable and follow with your code.

Just remember to follow the instructions that were given to you in that lesson!