So after going through your code, I see the small issue here:
Original Code: The condition 0 if start always assigns 0 to all nodes because the start is a non-empty string (which is always truthy), so the condition evaluates to 0 for every node.
Fix: To fix this, think about how you can compare each node in the graph to the start node. You want to set the distance to 0 only for the starting node, and float(‘inf’) for all the others. Like how could you modify the condition to compare each node with start?
Hi. The condition between your “if” and “else” is start (see the example code for the condition placement). Set out what is your condition doing and then compare it to the condition the instructions are asking for.
You’re very close! Instead of using 0 if start, think of it as assigning 0 only to the start node, and infinity to all other nodes. This way, you’re ensuring that only the start node gets a distance of 0 and the rest get infinity initially. That should fix the issue. Let us know if you’re still having trouble.