C2_W1_Assignment -I got an unexpected result despite passing all previous tests

Problem happens after # UNQ_C11 GRADED FUNCTION: min_edit_distance.
I wrote the function and my result is same with expected results of cell which starts with "testing your implementation ". In addition, I passed all the previous code tests in this assignment.
But arriving at the part beginning with sentence “We can now test several of our routines at once”, my results are different from expected results.

Is there anyone who can help me figure out what went wrong?


Hi @Nadle

You most probably hard-coded the replacement cost in your code. For example, you might have set r_cost = 2 instead of r_cost = rep_cost in your min_edit_distance() function implementation.

I am sorry for late response
seeing my code again, I did not hard-code the not only replacement cost variable but also all variables in the function :smiling_face_with_tear:

In the screenshot below, there are strings that cannot be created by modifying one character. This suggests that the edit_one_letter function has a problem. However, the edit_one_letter test passed. What do you think?

Hi Nadle,

Looks like there is a problem with your replace_letter function. You are replacing two characters instead of one. Have a look at your list comprehension defining replace_l in replace_letter and the way you call replace_letter in edit_one_letter.