Tower of Hanoi

Hi guys,
I am stuck in the Tower of hanoi project.

I get the following syntax error anytime i run " python3" in the terminal:

SyntaxError: unexpected EOF while parsing.

Here’s the code of

from stack import Stack

print("\nLet's play Towers of Hanoi!!")

#Create the Stacks
stacks = []
left_stack = Stack("Left")
middle_stack = Stack("Middle")
right_stack = Stack("Right")

stacks.extend([left_stack, middle_stack, right_stack])

#Set up the Game
num_disks = int(input("\nHow many disks do you want to play with?\n")

#Get User Input

#Play the Game```

Have you tried googling this error tee what might cause it?

This can be caused by forgetting to close a string:

"oops, i forgot to close the string

or forgetting to close a function call:

print("oops, i forgot to close the print function call"

yep, I found the following:

“If you have this error, you have a syntax error where something has started and wasn’t completed before the file ended. Such an error could be introduced by something like a missing parenthesis, for example, but any statement or expression that hasn’t been properly terminated could cause the issue. Either the author introduced the error, or you’ve got a corrupted file (e. g., some of the file was lost, and the data just ends in the middle of something).”

But i did’nt get where the error is in my code

1 Like

Let me help you a bit then, this:

is the problem you have. So you found the right information :slight_smile:

1 Like