PygLatin Help Ending Up


#1


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

I generated my code, and the function does work as expected, however, I get an error message that says "Oops, try again. It looks like you printed the correct translation of "python", but make sure to set new_word equal to the slice as well."

And I don't know how to set new_word equal to the slide.

I expected to be able to move on the in the tutorial.


pyg = 'ay'

original = raw_input('Enter a word:')

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

else:
    
    print 'empty'


#2

@coreblaster06119 here check my code:

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 = new_word[1:len(new_word)]

In your code the value that your giving to the new word must be done after the else structure is completed as is done in my code.
check the code and see if you need any other help and if satisfied mark it as a solution. :smile:
Just take care of the indentation.


#3

i have exactly the problem too


#4

This worked for me:
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:]
print new_word
else:
print 'empty'


#5

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