PygLatin correct translation, yet error


The code seems to run properly, but I get the error message:

"Oops, try again. It looks like you printed the correct translation of "cinema", but make sure to set new_word equal to the slice as well."

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


Your error message pretty much spells it out for you, but here's a hint.

Notice how you don't store this line of code under any variable. And the error message says:

Hmmm....I wonder what you should do. I'm sure you can figure it out now. :slight_smile:


Yep, I think I've tried what you're suggesting.

When I set new_word equal to the slice like this :

new_word = [1:len(new_word)]

the code no longer runs and I get a syntax error in the console :

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

is this the solution you were getting at? Any idea why the code won't run anymore?




new_word = new_word[1:len(new_word)]


Good job! :slight_smile:


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