Need Help With Ending Up!


#1

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

#2

Here:
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 ?


#3

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
[1:len.new_word]
^
SyntaxError: invalid syntax


#4

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

using len()
len(something)

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..

hint**
How we reassign a variable to itself.

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

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

#5

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:


#6