3. Input



Welcome to the Pig Latin Translator!
Traceback (most recent call last):
File "python", line 3, in
NameError: name 'original' is not defined

print 'Welcome to the Pig Latin Translator!'

variable_name = original('Prompt')
raw_input("Enter a word:")

I'm off track somewhere. Please advise


You'd start by considering what the incorrect behaviour is, your error message has something to say so you can start with determining whether you agree with that being a problem and then you can start considering what reasons there are and what you can do to fix that.


In the hint, where it says 'variable_name" it means replace it with the name of the variable not actually type "variable_name". Also, 'Prompt' should be replaced with the phrase that prompts the user for a command. Your code should be:

print 'Welcome to the Pig Latin Translator!'

original = raw_input("Enter a word:")


So just to check, if you are doing original = raw_input("Enter a word:"), then you don't have to have it separately on another line? As in:

raw_input("Enter a word:")

original = raw_input("Enter a word:")

That just seems like something that would deserve its own line.


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