You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
visited = set(start) must be replaced by visited = set(), visited.add(start) or so, as it doesn't add the tuple to the set, but iterates over the content of said tuple and adds that.
In [1]: point1 = (1,2)
In [2]: point2 = (3,4)
In [3]: visited = set(point1)
In [4]: visited.add(point2)
In [5]: point2 in visited
Out[5]: True
In [6]: point1 in visited
Out[6]: False
In [7]: visited
Out[7]: {(3, 4), 1, 2}
The text was updated successfully, but these errors were encountered:
visited = set(start)
must be replaced byvisited = set()
,visited.add(start)
or so, as it doesn't add the tuple to the set, but iterates over the content of said tuple and adds that.The text was updated successfully, but these errors were encountered: