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

Tell us what’s happening:

I’m not sure where it’s going wrong. Trying my best to understand

Your code so far


# User Editable Region

my_graph = {
    ['A', '3']: ['B', 'D'],

# User Editable Region

    'B': ['A', 'C'],
    'C': ['B', 'D'],
    'D': ['A', 'C']
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

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

the key of the dictionary can’t be a list
the key has to stay “A”, while the value will be a list of tuples

my_graph = {
‘A’: [(‘B’, ‘3’)], [(‘D’, ‘1’)],

Looks good but pay attention to the difference between numbers and strings.

print('1' + '3')
>>> 13

print(1 + 3)
>>> 4

1 Like

Thank you, I got it solved now. I also had too many brackets only 2 were required

1 Like