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

Tell us what’s happening:

My for loop is not getting accepted, perhaps I’m misreading the question?

Your code so far

my_graph = {
    'A': [('B', 3), ('D', 1)],
    'B': [('A', 3), ('C', 4)],
    'C': [('B', 4), ('D', 7)],
    'D': [('A', 1), ('C', 7)]
}


/* User Editable Region */

def shortest_path(graph, start):
    unvisited = []
    for graph in shortest_path:


/* User Editable Region */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

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

you need to have something inside the loop, read again the instructions, you are missing something

Perhaps univisted.append() but this still doesn’t work

but append what?

also, you need to change the names in the loop, you need to loop over graph to get each node.

redacted solution by mod - please do not post solutions

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.