[Tutor] SyntaxError Message

Danny Yoo dyoo at hashcollision.org
Tue Jul 8 09:07:37 CEST 2014

> I have no programming experience and am trying to  teaching myself python.
> Am trying to replicate the code below but I get the error message below
> highlighted in yellow:

We need a little more information.  Where does this code come from?
What text book or instructional material are you using?

I ask because the code you're doing is unusual looking, and appears to
be out-of-context.  To be more specific, the following part of your

        return input ("1")

doesn't make too much sense in isolation.

The errors you're seeing are due to the fish-out-of-waterness of the
code: the "return" statement only makes sense if you're writing a
function definition, but if you're just getting started, you probably
haven't learned about how to write function definitions yet.

If you can point us to the instructional material you're looking at,
we might give better suggestions as to what's missing.

But alternatively, have you tried the following tutorial instead?


It may be a gentler introduction to the language than what you're
looking at now.

Good luck!  If you have more questions, please feel free to ask.

More information about the Tutor mailing list