Assuming we got 2 lists, always with the same length and always containing strings.
list1 = ['sot', 'sot', 'ts', 'gg', 'gg', 'gg']
list2 = ['gg', 'gg', 'gg', 'gg', 'gg', 'sot']
we need to find:
How many items of the list2
should change, in order for it to be equals with list1
.
So on the previous example it should return 2
For this example:
list1 = ['sot', 'sot', 'ts', 'gg', 'gg', 'gg']
list2 = ['gg', 'gg', 'gg', 'gg', 'sot', 'sot']
it should return 1
and finally for this example:
list1 = ['sot', 'sot', 'ts', 'gg', 'gg', 'gg']
list2 = ['ts', 'ts', 'ts', 'ts', 'ts', 'ts']
it should return 5
.
We do not care about which elements should change to what. We neither care about the order, so that means that
['gg', 'gg', 'gg', 'gg', 'gg', 'sot']
and
['gg', 'gg', 'sot', 'gg', 'gg', 'gg']
are equal and the result of them should be 0.
The length of the lists could be 6, 8, 20 or whatever and sometimes there are more elements in place.
I tried a lot of things like set(list1) - set(list2)
,list(set(list1).difference(list2))
, set(list1).symmetric_difference(set(list2))
but without any success.