mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-07 06:02:06 -04:00
968 B
968 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6566195b0a021bb660b2b4b1 | Schritt 16 | 20 | step-16 |
--description--
Now modify my_graph["B"] into a list of tuples. The B-C distance is 4.
--hints--
my_graph["B"] should be a list of tuples.
({ test: () => assert(__pyodide.runPython(`
graph = __locals.get("my_graph")
type(graph["B"]) is list and all(type(i) is tuple for i in graph["B"])
`))
})
my_graph["B"] should be a list of tuples where the first item in the tuple is the connected node and the second item is the distance.
({ test: () => assert(__pyodide.runPython(`
graph = __locals.get("my_graph")
tuples = [("A", 3), ("C", 4)]
len(graph["B"]) == 2 and all(t in graph["B"] for t in tuples)
`))
})
--seed--
--seed-contents--
--fcc-editable-region--
my_graph = {
'A': [('B', 3), ('D', 1)],
'B': ['A', 'C'],
--fcc-editable-region--
'C': ['B', 'D'],
'D': ['A', 'C']
}