C2_W1 assignment: Exercise 11

Hello. I’m working on Exercise 11 (min_edit_distance) of week 1 assignment. I’m able to pass all the tests, except for one, which is the following.

Distance matrix has wrong values.
Expected: [[ 0 2 4 6 8 10]
[ 2 0 2 4 6 8]
[ 4 2 0 2 4 6]
[ 6 4 2 0 2 4]
[ 8 6 4 2 3 5]].
Got: [[0 1 2 3 4 5]
[1 0 2 4 6 7]
[2 2 0 2 4 6]
[3 4 2 0 2 4]
[4 6 4 2 3 5]].
15 Tests passed
1 Tests failed

That test is using different values for del_cost, ins_cost, and rep_cost, and I think that’s what causing the problem. However, I don’t see any error in my code. I’m using the correct variables to pass the values of del_cost, ins_cost, and rep_cost.

Can someone please help me with this?

1 Like

Hi @Erika_Petersen

Ensure that you are correctly implementing and using these costs in your distance matrix calculations. Double-check that you are passing the correct variables and that the logic properly uses del_cost, ins_cost, and rep_cost at each step by debugging and printing intermediate values!

If everything appears correct and the problem persists, you can send your code in PV so we can check it out.

1 Like

Thank you for your answer. I have checked my code and debugged it as best as I could, but I still don’t see where the issue might be. I’d like to send you my code in PV (what does PV stand for?). What do I have to do to send it that way?

1 Like

That is completely fine!

I think it is the short form of Private :grin:

You can click on my Profile, the hit the Message button!

1 Like

is the issue resolved @Erika_Petersen ?

Hi @Erika_Petersen

I haven’t received any messages from you! Feel free to send me your code if you are still having problems!

2 Likes

Hi @Erika

Sharing a similar thread output as yours, check if you have the same issue

If not, you can sent codes to the mentor.

Regards
DP

Hi @Alireza_Saei! Sorry I was slow to respond. I looked at the post shared by Deepti_Prasad and I was able to identify the bug I had in my code. I wasn’t initializing row 0 and col 0 correctly.

Thanks so much for your help!

1 Like

Hi @Deepti_Prasad! The issue described in the post you shared was exactly the bug I had! I have fixed it and now I’m able to pass all the tests. Thank you very much!

2 Likes

You’re welcome, good luck :raised_hands:

2 Likes