Pyg Latin


#1


PygLatin - Ending Up

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

I really dont understand how it will work. I have set new_word to print and it slice up as well but it is throwing up an error.
I NEED HELP!

Replace this line with your 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
    print new_word[1:]
else :
    print 'empty'


#2

pyg = 'ay'

original = raw_input('Enter a word:')

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

So I tried this code and amazingly it worked. I understand how this code works but what I dont understand is why that previous code didnot work and came with an error. If anyone can help me?


#3

the exercise wants you to store the sliced version in new_word, you took a shortcut in the first code, the exercise doesn't approve this


#4

I am sorry I didnot get it. Can you tell which shortcut I have taken?
Help appreciated!


#5

here you print the slice directly:

print new_word[1:]

but the exercise wants you to store the slice, and then print it.

which is what you did in your second code


#6

thanks! I get it now.


#7