Files

1.4 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6557712d77ce2d9bd7e63afd Step 13 20 step-13

--description--

Add another node connected to B to your graph and call it C.

Modify your existing dictionary to represent this arrangement. Use a list to represent the multiple connections of your B node.

--hints--

Your dictionary should have 3 keys — A, B, and C.

({ test: () => assert(__pyodide.runPython(`
    graph = __locals.get("my_graph")
    key_list = ["A", "B", "C"]
    len(graph) == 3 and all(key in graph for key in key_list)
  `))
})

my_graph["A"] should have the B node as the value.

({ test: () => assert(__pyodide.runPython(`
    graph = __locals.get("my_graph")
    graph["A"] == "B"
  `))
})

my_graph["B"] should be a list.

({ test: () => assert(__pyodide.runPython(`
    graph = __locals.get("my_graph")
    type(graph["B"]) is list
  `))
})

The value of my_graph["B"] should be a list containing the other two nodes.

({ test: () => assert(__pyodide.runPython(`
    graph = __locals.get("my_graph")
    len(graph["B"]) == 2 and "A" in graph["B"] and "C" in graph["B"]
  `))
})

The value of my_graph["C"] should be the connected node.

({ test: () => assert(__pyodide.runPython(`
    graph = __locals.get("my_graph")
    graph["C"] == "B"
  `))
})

--seed--

--seed-contents--

--fcc-editable-region--
my_graph = {
    'A': 'B',
    'B': 'A'
}
--fcc-editable-region--