Why is this not working?



invalid syntax

print correctly

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 original
    print word
    print first
    print new_word
    print 'empty'


Hi @boardjumper76579,

This is invalid ...

new_word = [1:len(new_word)]

Evidently, you are trying to take a slice of new_word. The slice specifier must follow the expression that represents the value you are trying to slice. In this case, the expression is new_word, and the slice specifier is [1:len(new_word)]. Therefore, you need ,,,

    new_word = new_word[1:len(new_word)]


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