Learn Algorithm Design by Building a Shortest Path Algorithm - Step 18

Tell us what’s happening:

Hello@friends, I’m hesitate at this stage, I need help on how to solve this question

Your code so far


# User Editable Region

my_graph = {
    'A': 'B',
    'B': ['A','C'],
    'B': 'C',
    'C': 'B'
}
my_graph['B']

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (iPhone; CPU iPhone OS 15_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/120.0.6099.119 Mobile/15E148 Safari/604.1

Challenge Information:

Learn Algorithm Design by Building a Shortest Path Algorithm - Step 18

Hi @Osei17

The error message when no code is entered.

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

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

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

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

Note that keys in Python are unique identifers, so you cannot have duplicates.

Happy coding