Computer science path tower of hanoi

does anyone know why I’m having a syntax error here

Your last error message doesn’t match your code, so I’m not sure what you’re asking.

Syntax error are almost always trivial, the code couldn’t be matched to anything that python understands as valid code, so you’d look at what you wrote at that location and the context it’s in (what’s valid may depend on what was written earlier)

It can be easier to figure out if you reproduce the syntax error with less code, that way you narrow it down. You can similarly comment out the part that is being complained about and maybe then the error will be reported closer to where it’s really caused, or if that makes it disappear then you’ve confirmed that the problem is with the part you commented out. You might also want to make sure that it parses after each small piece of code that you write, then you know it has something to do with what you just wrote.


This error message is a little tricky.
In fact you should take a look at line 12.

1 Like

As a general rule, if you see a SyntaxError error raised on a line that you “just know” is correct, look to the preceding line or block for an unclosed sequence.