# Learn Algorithm Design by Building a Shortest Path Algorithm - Step 35

### Tell us what’s happening:

``````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 = list(graph)
distances = {node: node == 0 if node == start else node == float('inf') for node in graph}
paths = {node: [] for node in graph}
print(f'Unvisited: {unvisited}\nDistances: {distances}')

shortest_path(my_graph, 'A')

# User Editable Region

``````

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 Edg/125.0.0.0`

### Challenge Information:

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

Try to use the exact same syntax as the example given, but you re replacing `key` with `node`

``````{key: val_1 if condition else val_2 for key in dict}
{node: node == 0 if node == start else node == float('inf') for node in graph}
``````

You can see the example does not use a comparison operator (`==`). That’s only used to check if two variables are equal, not for assigning a value, in any case.

Thanks! but I’m still confused. I delete the ‘==’, it still doesn’t work

Use the exact format of the given example. Please share your updated code.

try this: —removed

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.