Pyg Latin Says It's Working, But It Isn't


#1



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


It should be changing the inputted word to a "pig latin-ized" version but it just spits out the lower cap version and says it's good to go. For instance when I type "BobBY" it should return "obbybay" but it returns "bobby".


pyg = 'ay'

original = raw_input('Enter a word:')

original = original.lower()

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

I believe this should be the correct code:

pyg = 'ay'

original = raw_input('Enter a word:')

original = original.lower()

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

The problem is that the CodeAcademy tutorial passed me with the first section of code which should have been flagged as incorrect.


#2

you print original, to show the pyglatin version print new_word


#3

The problem is that the CodeAcademy tutorial passed me with the first section of code which should have been flagged as incorrect.


#4

testing testing is this thing on doesn't have any validation, its just a lesson where you can experiment with your code


#5

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