mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-25 23:01:26 -05:00
1.1 KiB
1.1 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 655773f8b8b5db9fc6d0ae76 | Step 20 | 20 | step-20 |
--description--
To keep track of the visited nodes, you need a list of all the nodes in the graph. Once a node is visited, it will be removed from that list.
Now, replace the pass keyword with a variable named unvisited and assign it an empty list.
--hints--
You should have a variable called unvisited.
({ test: () =>
{
const shortest_path = __helpers.python.getDef(code, "shortest_path");
const {function_body} = shortest_path;
assert(function_body.match(/unvisited\s*=/));
}
})
Your unvisited variable should be an empty list.
({ test: () =>
{
const shortest_path = __helpers.python.getDef(code, "shortest_path");
const {function_body} = shortest_path;
assert(function_body.match(/unvisited\s*=\s*\[\s*\]/));
}
})
--seed--
--seed-contents--
--fcc-editable-region--
my_graph = {
'A': [('B', 3), ('D', 1)],
'B': [('A', 3), ('C', 4)],
'C': [('B', 4), ('D', 7)],
'D': [('A', 1), ('C', 7)]
}
def shortest_path(graph, start):
pass
--fcc-editable-region--