mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-12 01:00:13 -04:00
1.9 KiB
1.9 KiB
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6557716aadbd2d9c42c0e69a | Step 19 | 20 | step-19 |
--description--
Add one last node, 'D', which is connected with 'A' and 'C'.
Modify your dictionary to represent this structure. Again, use a list to represent multiple connections.
--hints--
Your dictionary should have 4 keys called '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)
`))
})
my_graph['A'] should be a list.
({ test: () => assert(runPython(`
type(my_graph["A"]) is list
`))
})
my_graph['A'] should be a list containing 'B' and 'D'.
({ test: () => assert(runPython(`
len(my_graph["A"]) == 2 and "B" in my_graph["A"] and "D" in my_graph["A"]
`))
})
my_graph['B'] should be a list.
({ test: () => assert(runPython(`
type(my_graph["B"]) is list
`))
})
my_graph['B'] should be a list containing 'A' and 'C'.
({ test: () => assert(runPython(`
len(my_graph["B"]) == 2 and "A" in my_graph["B"] and "C" in my_graph["B"]
`))
})
my_graph['C'] should be a list.
({ test: () => assert(runPython(`
type(my_graph["C"]) is list
`))
})
my_graph['C'] should be a list containing 'B' and 'D'.
({ test: () => assert(runPython(`
len(my_graph["C"]) == 2 and "B" in my_graph["C"] and "D" in my_graph["C"]
`))
})
my_graph['D'] should be a list.
({ test: () => assert(runPython(`
type(my_graph["D"]) is list
`))
})
my_graph['D'] should be a list containing 'A' and 'C'.
({ test: () => assert(runPython(`
len(my_graph["D"]) == 2 and "A" in my_graph["D"] and "C" in my_graph["D"]
`))
})
--seed--
--seed-contents--
--fcc-editable-region--
my_graph = {
'A': 'B',
'B': ['A', 'C'],
'C': 'B'
}
--fcc-editable-region--