What is the error?


#1

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)]
print new_word
else:
print 'empty'

The error shown is:
File "python", line 9
new_word= [1:len(new_word)]
^
SyntaxError: invalid syntax

I dont get the error....i even copy pasted whats given in the instructions but still get the same error.... anyone having the same problem?


#2

Hello! So, what I think the problem is is that you need to put in:

new_word = new_word[1:len(new_word)]

NOT

new_word = [1:len(new_word)]

But....

if you still need to know how I did it, then here:

This is what I have:

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 = new_word[1: len(new_word)]
print new_word

else:
print 'empty'

Don't forget to INDENT before the print 'empty' and the print new_word.


#3

Hope it helps @yashjhaveri