I am comparing string similarity between 2 lists of strings and whenever the similarity function is >0 I loose the word2 value:
list1=['aaaa','cccc','bb']
list2=['aaa','fff','v']
for word1 in list1:
for word2 in list2:
if (similar(word1 ,word2)>0):
print(word2)
similar is Sequence Matcher:
def similar(a, b):
s= SequenceMatcher(a,b).ratio()
s=round(s*100,1)
return s
If the 'similar' function is>0 then my word2 becomes ''.
If i check for similar(word1,word2)==0
then my value stays right.