Im having a problem to iterate between 2 lists to see if one of them has the elements of the other. Inside of one of those lists, I have another list. Sometimes this list have only strings, sometimes strings and.. another list.
So here is the problem. If It has strings only, I would like to know if ALL of those strings are inside the Mainlist.
But, If I have srtings AND another list.. I would like to know if ALL of the strings outside the list are in the Mainlist and if AT LEAST ONE string inside the list are in the Mainlist.
So, lets say I have a Mainlist:
Mainlist = ['AA', 'BB', 'CC', 'DD', 'EE', 'FF']
Now, I have other list that I want to iterate over this Mainlist:
list1 = [['AA', ['BB', 'YY']], ['AA', 'GG']]
On list1 I have two lists : ['AA', ['BB', 'YY']] and ['AA', 'GG'] One has only strings and the other has strings and another list.
Now I need to know if the elements on list1 are on Mainlist and get the index of the ones at list1 that give me a True result.
In this case, it wolud be Trueat index 0. Because Mainlist has items 'AA'and 'BB' .
other examples:
list2 = [['AA', 'JJ'], ['EE', 'FF']] # False at index 0 = Mainlist does not have 'JJ' / True at index 1 = Mainlist has 'EE' and 'FF'
list3 = [['AA', 'KK', ['BB', 'CC']], ['JJ', 'GG']] # False at index 0 item 'KK' is not in Mainlist / False at index 1 = Mainlist does not have 'JJ' and 'GG'
list4 = [['EE', 'FF', "OO"], ['AA', 'BB', 'CC',['DD', 'MM']], ['GG', ['BB', 'CC', 'DD']]] #False at index 0 = Mainlist does not have 'OO' / True at index 1 = Even if 'MM' is not in Mainlist, 'DD' is. / False at index 2 = 'GG' is not in Mainlist
I am having a headache trying to achive that.. Does anyone has a hint that could help me with this? Thanks in advance