Ending Up (invalid syntax)



Your code did not run to end. (SyntaxError: invalid syntax)

pyg = 'ay'

original = raw_input('Enter a word:')

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



I guess you're trying to optimize things here? :wink:

Now, you want to set new_word as the slice, but you need to be doing that by indexing new_word from its first index position to the end.

You could split that line by doing:

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

Next, you need to print this new_word and not original

I hope I helped! :wink:


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