Check Yourself


#1

I have a question regarding this exercise.
https://www.codecademy.com/courses/python-beginner-2W5v7/0/4?curriculum_id=4f89dab3d788890003000096#

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
else: 
    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?


#2

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?


#3

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: https://www.codecademy.com/en/courses/python-beginner-2W5v7/0/3?curriculum_id=4f89dab3d788890003000096


#4

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.


#5

I don’t understand…


#6

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.


#7