4. Check Yourself - prints empty as well as raw input


4. Check Yourself

It doesn't come up with an error message but running the code prints both the raw input value as well as "empty". Is this supposed to happen? I can't see anything wrong with 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"


this line is the problem,

because this,

Should be stored in the variable original like so,

original = raw_input("Enter a word: ")
#Note: I added a space after Enter a word: and the closing parentheses"


Awesome, thanks for that. That works and has solved my problem.

Just for my understanding, why can you not assign the raw input as to the variable after the raw_input() function has been set?


Because it is like setting the variable original to an empty raw_input


Okay that makes sense, thanks for your help!


You're welcome :grin: if that was the answer you were looking for feel free to click the solution button below my reply. :slight_smile:


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