Ending Up


this is my code but it doesn't work but I do not understand why.

this is my code that I have created

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    print original
    word= original.lower()
    first= word[0]
    new_word= original + [1:len(new_word)] + first + pyg
    print new_word
    print 'empty'
this is the error message that is coming up
  File "python", line 9
    new_word= original + [1:len(new_word)] + first + pyg
SyntaxError: invalid syntax


new_word isn't defined at that point.



I see what your problem is, '+' is not needed between original and 'slicing', should be:

new_word= original[1:len(original)] + first + pyg

original[1:len(original) should be together - it means cut the block of letters from original variable from letter no. 1 till last letter (length of the string) of the original variable and not new_word as you wrote