Files
2024-05-22 17:27:37 +02:00

1.4 KiB

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

--description--

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

Modify your existing dictionary to represent this arrangement: add another key 'C' to my_graph and give it the value of the string 'B'.

Also, change the value of the existing 'B' key into the list ['A', 'C'] to represent the multiple connections of your 'B' node.

--hints--

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

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

The value of my_graph['A'] should be the string 'B'.

({ test: () => assert(runPython(`
    my_graph["A"] == "B"
  `))
})

my_graph['B'] should be a list.

({ test: () => assert(runPython(`
    type(my_graph["B"]) is list
  `))
})

The value of 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"]
  `))
})

The value of my_graph['C'] should be the string 'B'.

({ test: () => assert(runPython(`
    my_graph["C"] == "B"
  `))
})

--seed--

--seed-contents--

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