Why is this not working?


#1



PygLatin


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


#2

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)]

#3

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