Ending Up Ch 10


#1



Link to the exercise: https://www.codecademy.com/en/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096#

When I click submit code, it is OK, but when I enter a word in the console, it gives the error:

Traceback (most recent call last):
File "python", line 9, in
TypeError: slice indices must be integers or None or have an index method


Ï want to apply the method described in the instructions.


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=new_word[1:(new_word)]
    print new_word
else:
    print 'empty'


#2

you want to the slice till the end of new_word, in other words the length (len()) of new_word.


#4

that is also possible.


#5