Ending Up error


#1



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


SyntaxError: invalid syntax
it tells me that here ------> new_word = [1:len(new_word)]
the ":" column is an error


pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

pyg = 'ay'

original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]

if len(word) > 0 and word.isalpha():
print new_word[1:len(new_word)]
else:
print 'empty'


#3

my english is not that food for explaining thongs but It took me a while to understand.You need to switch up your codes a little bit to get it to work..and here is what i got that helped me passed


#4

Ok nvm I figured it out. Completed 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 = new_word[1:len(new_word)]
print new_word
else:
print 'empty'


#5

@arrayrunner95222 This line is messing you up.

You are stating that the variable 'new_word' is the second character to the last character of 'new_word'? I think you meant to write 'word' instead, since that is the input needed. Also, you need to have the variable name before the brackets. Lastly, you are suppose to add the variable 'first' and 'pyg' to make the actual PygLatin form of the word.

new_word= word[1:len(word)] + first + pyg

Hope that help! Let me know if you have any other problems. Good luck and happy coding! :slight_smile:
-- @chipjumper36731


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.