Brad Desautels wrote:
Ya, I did try to run it and I am getting a syntax error before it runs.

Then fix the syntax error.

Do you need help understanding the error? If so, please COPY and PASTE the entire error here, do not try to re-type it, specially not from memory.

One hint that a lot of beginners miss is that the syntax error includes a pointer to the first mistake: it uses a ^ on an otherwise blank line to point to the first part of the code that is wrong:

>>> if x=y:
  File "<stdin>", line 1
    if x=y:
        ^
SyntaxError: invalid syntax

This tells me that I can't say "if x=y" (assignment), but I need equality instead: "if x==y".

Another thing that sometimes catches even experienced programmers: if you forget to close brackets (round, square or curly), you will often get the SyntaxError on the *following* line:


>>> mylist = [1, 2, 3
... for m in mylist:
  File "<stdin>", line 2
    for m in mylist:
      ^
SyntaxError: invalid syntax




--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to