listA = ['HM', 'GL', 'WD', 'HM', 'WD', 'HM', 'WD']
sublist = [['HM','GL'], ['GL'], ['WD','HM'], ['WD','GL'], ['WD'], ['HM','WD'], ['HM']]
Both list
and sublist
are of equal lengths, the output should be mismatching index, i.e. [3,5]
index number of list
are not found in corresponding sublist
.
I think correct answer should be [3, 6]
:
listA = ['HM', 'GL', 'WD', 'HM', 'WD', 'HM', 'WD']
sublist = [['HM','GL'], ['GL'], ['WD','HM'], ['WD','GL'], ['WD'], ['HM','WD'], ['HM']]
print([i for i, (a, b) in enumerate(zip(listA, sublist)) if not a in b])
Prints:
[3, 6]