Need Help With Ending Up!


PygLatin - Ending Up

When I try to run my code it does not work and gives me an error message, i'm pretty sure it's to do with the slicing part.
Error Message: Traceback (most recent call last):
File "python", line 9, in
AttributeError: 'builtin_function_or_method' object has no attribute 'new_word'

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


The instruction of lesson says...

Set new_word equal to the slice from the 1st index all the way to the end of new_word. Use [1:len(new_word)] to do this.

But you're not putting new_word[1:] into new_word ?


I think I tried that or already, but I still got an error message, sorry if I seem naive or noobish.
I tried replacing it with [1:len.new_word] but I got this as an error message;
Oops, try again. Your code did not run to end - see the console window for the error message.

and in the console:
File "python", line 9
SyntaxError: invalid syntax


wrong use of len() method...
[1:len.new_word] ?

using len()

new_word[1:] is same as saying [1:len(new_word)]

But as said in instruction, You need to re-assign it again to itself..

How we reassign a variable to itself.

x = [2,3,4,5,6]

x = x[1:] # now this list is [3,4,5,6]


Thank you so much! :smile: It worked after I replaced it with the code and it went through fine, I think i must've misread the instructions or something, but thanks again for the fast reply and helpful tip, I really appreciate it. :smiley: