Check Yourself


I have a question regarding this exercise.

This is my code:

print 'Welcome to the Pig Latin Translator!'

raw_input("Enter a word:")
original = raw_input()
if len(original) > 0: 
    print original
    print "empty"

When I run this code, and I enter a word I get “empty” as the output while I should be getting the word I entered. How do I fix this?


Combine these two lines into one.

The above has been making the rounds in the forums, in this exact form. Are you sure you didn’t copy it from somewhere? If not, what part of the instructions led you to believe it should be written this way?


Thanks so much, it’s okay now. I didn’t copy it from anyone, I thought it should be written that way because of the instructions in the previous section “Input!”. Here it is:


So it is the instructions that are throwing everyone off. Thanks for clarifying.

On line 4, use raw_input("Enter a word:") to ask the user to enter a word. Save the results of raw_input() in a variable called original

Somehow learners are translating this into two steps when it is really only one.

original = ...

All assignments are written this way, even if the instructions are backward.


I don’t understand…


The best thing to do then is start a new topic with your question, a link to the lesson, your code, and any error messages. This topic is resolved.