[Tutor] SyntaxError Message

Danny Yoo dyoo at hashcollision.org
Tue Jul 8 09:36:06 CEST 2014


Following up.  I can guess that you're looking at:

    http://www.sthurlow.com/python/lesson05/

But I would like not to guess unless I have no choice. In the future,
if you're asking for help, provide context.  The reason why it's very
useful to say where you're learning from is because we can then look
at previous things you have seen before, and try to relate those past
things with what you're doing now.

In this case, now that I know the context more, I can look at the
material myself and see if it makes sense.  Sometimes tutorials can be
confusingly written.

Ah.  In particular, the "Code Example 9" in the link above is not
presented well.  I say this because it is not even a complete program!
 And yet the author is notating it as if it were a complete program by
putting it in its own figure.  If you tried to do Code Example 9, it
would raise the exact same error messages you're seeing now.

Hmm... I have other reservations about this tutorial.  It's presumably
trying to teach functions, but it is not really using the functions as
things that return useful values.  add(), sub(), mul(), and div() in
Code Example 14 are not great examples of functions.


I think you may want to switch to a different tutorial and see if it
is easier to approach.  Since you're using Python 2, I have to
backtrack on the tutorial I linked in a previous message: I needed to
have referred to a tutorial that used Python 2, not Python 3.  My
apologies!

Here is a link to a good tutorial:
http://openbookproject.net/thinkcs/python/english2e/

Please try that one instead and see if it makes more sense.


More information about the Tutor mailing list