Step 47 - Algorithm Design by Building a Shortest Path Algorithm

Thisi si my link:
Good day to all… me again…
this below is my code

 if paths[current][:] == paths[node]:
                    paths[node] = paths[current]

When I run this code I get the output from the console and this make me happy. But the code does not pass. The code doesn’t pass because the slice syntax is wrong. I use [:] to copy all the items from the list.

Previsouly , just to play around, I run the below block of code and I got the identical result and error:

if paths[node] == paths[current][:]:
                 paths[node] = paths[current]

Can you give the link to the step?


If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Good work with the slice, but it’s in the wrong place. Here’s a clue from the instructions:

Modify the existing assignment inside your if block.

== this is a comparison
= this is an assignment

I love you so much…your ‘Good work with the slice,but it’s in the wrong place’ and ’ == this is a comparison, = this is an assignment’ made me think and fix it. Thank you so much
nb: still have some issue to read properly the question.

1 Like

It’s difficult to translate between English and code :+1:

If you ever have a question about what the instructions are asking, you can always ask here!

you are right …probably is more difficult for me because I am not English native language. Honestly, with this step I was very close to stop here. Thank you again for your help.

1 Like

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