Traveling salesman problem solved as class assignment, python