Levenstein distance is a measure of distance between two string.
Intuitive defintion is the minimum number of modifications required to obtain string b from the given string a

The python implementation of the algorithm is the following. The logic of the algorithm is to caluclate the minimum number of , delets, and insertions, and replacements required to obtain string A from string A.
Intuitive defintion is the minimum number of modifications required to obtain string b from the given string a

The python implementation of the algorithm is the following.
def edit_distance(str1,str2,m,n):
if m==0:
return n
elif n==0:
return m
elif str1[m-1]==str2[n-1]:
return edit_distance(str1,str2,m-1,n-1)
else:
return 1+min(
edit_distance(str1,str2,m,n-1), # This is insert operation
edit_distance(str1,str2,m-1,n), # this is remove opeartion
edit_distance(str1,str2,m-1,n-1) # this is replace operation
)