“SyntaxError: 'return' outside function” What does that mean?


File "python", line 6
SyntaxError: 'return' outside function

I thought it would work out OK but...

print 'Welcome to the Pig Latin Translator!'

# Start coding here!
original = raw_input("Enter a word:")
if len(original) > 0:
    return original()
    return "empty"


return can only be used inside functions (and methods), you have neither


?? What does that mean?
Can you help me correct my code?


well, that return is not write, the instructions give a pretty big hint about what you should use:

If the string actually has some characters in it, print the user's word.
Otherwise (i.e. an else: statement), please print "empty".


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