What is wrong with my code


#1



pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

new_word=[1:len(new_word)] is incorrect. What you are trying to do is set new_word equal to an index, but python doesn't know what it's an index of. Make sure to include the string or variable that you are accessing through the index as well as the index.


#3

Check this line again. Is that how you access index?


#4

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