I have to write a function that takes a string as argument and compair this string to two other strings and return the string most similar and the number of differences.
def func("LUMB"):
lst=["JIBM", "NUNE", "NUMB"]
should return:
("NUMB",1)
I have tried:
def f(word):
lst=["JIBM", "NUNE", "NUMB"]
for i in lst:
d=k(word, lst)
return differences
for n in d:
print min(sum(n))
where:
def k(word1, word2):
L=[]
for w in range(len(word1)):
if word1[w] != word2[w]:
L.append(1)
else:
L.append(0)
return L
so that i get a list of eg, [1,0,0,0] if word1="NUMB" and word2="LUMB"