Pyglatin - Ending Up


#1



Pyglatin - Ending up


So I've gotten my code to give me the correct output but I keep getting the following error message:

"Oops, try again. The value for the original variable looks off, make sure that you entered a word containing only letters."

I've really tried but I can't see what I did wrong. Can anyone help me out on this one :slight_smile:


pyg = 'ay'

word = raw_input('Enter a word:').lower()

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


#2

Sorry, I fat fingered the code:

pyg = 'ay'

word = raw_input('Enter a word:').lower()

first = word[0]
new_word = word + first + pyg

if len(word) > 0 and word.isalpha():
print new_word[1:len(new_word)]
else:
print 'empty'

I'm still getting the same error message though


#3

First of all, you execute all necessary steps after you check that the user's input is not blank and contains alphabetical letters, so all of the steps to translate the word should be under the if statement. Also lower case the word under a different variable. It still may raise errors because you did not use the exact variables the directions wanted, and the lesson checker will not recognize it. In that case, use my code:

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
else:
    print 'empty'

#4

You spelled word wrong.


#5

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