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

### Tell us what’s happening:

I cant include the ‘inf’ to the code, that erro keep going:

You should assign `float('inf')` to `distances[node]` inside your new `else` clause

``````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 = []
distances = {}
for node in graph:
unvisited.append(node)
if node == start:
distances[node] = 0
else:
float('inf'(distances[node]))

# User Editable Region

``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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 24

Welcome to the forum @HttpsGabrisan

Your code is not in the correct order, also you need to use the assignment operator.

what would be the correct order?

Try reversing the order.

i tried many other ways i didn’t worked at all

float(distances[node])(‘inf’))

I cannot give the direct answer. Try using the code blocks given in the hint I posted earlier.

when you use the assignment operator you are saying “assing ‘thing on the right’ to ‘thing on the left’”

``````thing_on_the_left = thing_on_the_right
``````
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.