I have the following list of integers that I need to compare with eachother:
compare = [[2,4,5,7,8,10,12],[1,3,5,8,9,10,12],[1,2,4,6,8,10,11,12],[2,3,4,6,7,9,12]]
Even if you did not list the lists of names in lists in Python (I think), we simply call each count a, b, c and d.
What I want to do is make a for loop, which can compare if any one integer is present in 2, 3, or in all lists. The cycle itself is simple, it iterates over all integers in ad, but the conditions under which the comparisons are made are rather complicated or perhaps just long, for example, for example:
if i in a and i in b, or i in a and i in c... or i in a and i in b and i in c... or i in (every list):
pattern.append (i)
Obviously, this is impractical. I was looking for a solution to the problem, but to no avail. In addition, there would be | can operators be used anyway, or should I stick with AND and OR?
Thanks in advance for your help!