New_word=[1:len(new_word)]


#1

So I did this code:

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:len(new_word)]
    print(original)
else:
    print 'empty'

and here is the error

File "python", line 9
    new_word=[1:len(new_word)]
               ^
SyntaxError: invalid syntax

#2

You are trying to call a method, and to do this you need a dot . not a colon :


#3

Although everything should be right. Is it because I didn't put parentheses around

print 'empty'

?


#4

No? Why would you need parenthesis?


#5

You need to specify what value you are slicing.


#6

@cadecodes

So that line will look like this?:

new_word=[1.len(new_world)]

Although the instructions say

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.
Is there something wrong with the instructions?:hushed::hushed:

When I just started programming in Python I was taught to use parentheses.


#7

@ionatan
How do I do that?


#8

I'm sure that's what the instructions are all about
if not enough: google. "how to slice strings" or something.
The information is very much available to you


#9

@ionatan

I think I should be right because of this


#10

I've had this problem too and I am sure if the instructions for the Codecademy Python Pyg Latin Project 10/11 is fixed, then we wouldn't need to go on the forums to answer this question anymore.


#11

You're not being lied to. They give you a piece of code but it's not enough to copy it, it's not all there. If anything, it's good that you are getting a bit stuck on this, so that you won't pass until you know how to slice something! Now go read those instructions/look at other examples.


#12

Also, what does it mean when I run the code, it says AttributeError: 'int' object has no attribute 'len'?


#13

Exactly what it says. Read it as if it were English.


#14

I tried to add int() to len(new_word) and it didn't work.


#15

How long is 5?


#16

One digit long, I am sure.


#17

You can write 5 as 0b101


#18

So how does that help me?


#19

An integer has no length. Doesn't make sense. That's what it's telling you with that error message.


#20

So I just insert the binary length? How do I do that? What is the 0b?