Ending Up. Again


Posted about this before, and had one problem resolved, but now I have another.


Traceback (most recent call last):
File "python", line 7, in
NameError: name 'new_word' is not defined


pyg = 'ay'
original = raw_input('Enter a word:')

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

I cannot tell where I am going wrong here. Support?



new_word = new_word[1:len(new_word)]

you define new_word, but you also take a slice of new_word (while defining it) that doesn't work


So how do I go about it? Do I make separate variables to define and slice?


you defined new_word in the previous exercise (9. move it back), why did you remove it?

then here you take a slice of new_word which you defined in the previous exercise


I read another forum post saying replace the new_word variable with the new code. It worked the OP but I couldn't get it working. Now I understand, thank you.


you need to update/re-assign new_word, but not remove your new_word which was already there


Did it, finished the course. Also, added print new_word which I had forgotten until the end.


Well done :slight_smile: