Pyg Latin


#1

i dont know what to do in pyglatin lesson: Ending Up


#2

Hi @totallyfly,

Please post the code that you have thus far so that we can help with it.


#3

pyg = 'ay'

original = raw_input('Enter a word:')

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


#4

A couple of adjustments are necessary.

These four lines should all be moved to the if block ...

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

They should be placed right after this line ...

    print original

Make sure they are all indented properly.

Then this statement ...

    new_word[1:len(new_word)]

... needs to be modified, as follows, so that it actually assigns the result to new_word ...

    new_word = new_word[1:len(new_word)]

Right after that line, we need to display the output with this print statement ...

    print new_word

#5

thank you so much it now looks like this:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():

print original
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'


#6