# Learn-algorithm-design-by-building-a-shortest-path-algorithm step 23

``````# This is my code and I think it is correct but still doesn't pass: indentation error
def shortest_path(graph, start):
unvisited = []
distances = {0}
for node in graph:
unvisited.append(node)
if node == start:
``````

I am not sure when the step 23 asks "Then assign 0 to that node inside the distances dictionary.
In python I can add an item to the dictionary using a index key and assigning a value to it, right?? so inside distances I should have:

``````# This is my observatioin
distances = {'start': 0}
``````

What I am doing wrong here??
Thanks

Itâ€™s not passing because you need something in the if statement.
Do not modify this line, itâ€™s not mentioned in the instructions:

``````distances = {}
``````

â€śThe nodeâ€ť itâ€™s referring to is `node`, not `start`. Youâ€™ve already defined the `distances` dictionary, and assigned it an empty dictionary, so you donâ€™t want to define it again.

How would you access the `node` key of `distances` and assign it `0`?

``````dict = {
"country" : "India",
"continent" : "Asia",
"Other_name" : "Bharat"
}
x = dict["continent"]
print(x)
``````

is not correct the way I am thinking??

You are assigning the `dict` value for the key `continent` to `x`

How would you change the value for the key `continent` to â€śEuropeâ€ť ?

It would be:

``````dict['continent'] = "Europe"
``````

Now, how would you assign the key `node` in the dictionary `distances` to 0?

1 Like

Thank you @pkdvalis and at this point I will never make itâ€¦

``````# I think is this one but only works on my editor not to yours  :(
distances[node] = 0
``````

Never quit, youâ€™ll make it. All you have to do is be persistent.

This is correct. Try resetting the question you might have changed something else.

If it still doesnâ€™t work, please share the full updated code

Indeed I am doing something wrong I should not after three weeks with youâ€¦

``````# this below run ok in my editor but not into yours
def shortest_path(graph, start):
unvisited = []
distances = {}
for node in graph:
unvisited.append(node)
if node == start:
distances[node] = 0
``````

I am getting the below erro r and trying and trying again and again :
Sorry, your code does not pass. Keep trying.
You should create an `if` statement that executes when `node` is equal to `start`.

``````# is my if statement wrong..Personally, I do not think so.
if node == start:
``````

If you think you wonâ€™t make mistakes after studying programming for 3 weeks then your expectations were very, very wrong.

You have some inconsistent indentations here:

The `if` statement is part of the `for` loop and should also be indented.

``````def function():
code
code
for this in that:
code
code
if this == that:
code
code
``````

Dear @pkdvalis ,
now the code passâ€¦ It took more than 24 hours me to solve this stepâ€¦no good no at allâ€¦I am not happy with myself.
Thanks

You kept at it, you didnâ€™t give up. You solved it and most importantly you learned something. These are all great and worthwhile accomplishments!