I am trying to write part of my decision tree logic in Python. The data is coming from List 1 in dataframe 1 and List 2 and List 3 in dataframe 2. It states: if items in List 2 and List 3 are both found somewhere in List1 AND items in List 2 and List 3 side by side are NOT the same, then print out List 2 items. I am not sure how to approach this. Nested for loops? Or is there a function that would be best to use. If someone could point me in the right direction. Thanks!
for items 2 in list 2 AND for items 3 in list 3: for items 1 in list 1: if items 2 == items 1 AND if items 3 == items 1 AND if items 2 = [x for x, y in zip(list 2, list 3) if x != y]: then print items 2 in a list