mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 01:00:13 -04:00
980 B
980 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6566195b0a021bb660b2b4b1 | Step 21 | 20 | step-21 |
--description--
Now modify my_graph['B'] into a list of tuples, where the first element in the tuple is the connected node, and the second element is the distance. The B-C distance is 4.
--hints--
my_graph['B'] should be a list containing the tuples ('A', 3) and ('C', 4).
({ test: () => assert(runPython(`
tuples = [("A", 3), ("C", 4)]
len(my_graph["B"]) == 2 and all(t in my_graph["B"] for t in tuples)
`))
})
my_graph should have 4 keys named 'A', 'B', 'C', and 'D'.
({ test: () => assert(runPython(`
key_list = ["A", "B", "C", "D"]
len(my_graph) == 4 and all(key in my_graph for key in key_list)
`))
})
--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']
}