Remember to include a link to the exercise you need help with!
If someone answers your question, please mark their response as a solution
Once you understand a new concept, come back and try to help someone else! }
so im all done with the project but for some reason I get this error:
Traceback (most recent call last):
File “script.py”, line 78, in
File “script.py”, line 52, in traveling_salesperson
while not visited_all_vertices:
UnboundLocalError: local variable ‘visited_all_vertices’ referenced before assignment
Before I try to help you with the specific issue, tell me why you moved the last 2 lines of your code to the right. What was your thinking behind the decision? What effect did it have? Just to make sure we are all on the same page, the last 2 lines of your code are:
Well, from the last update to your code, you moved the function calls from where they should be to inside one of the functions to be called. You need to undo that first, and then deal with the original error that you had when you started this topic.
Line 52 of your code is shown in the error message. The error message tells you specifically what the problem is. It’s telling you that visited_all_vertices has not been assigned yet, but you are trying to query its assigned value. Where in your code is there an assignment to visited_all_vertices?
Here is a very simple example of code that throws the same error