[Solved] Provide the python code: Identify when the elements of a list exchanged positions in groups of three [closed]
def identify_cycles(l1, l2): d1 = {val: idx for idx, val in enumerate(l1)} # This assumes unique values in input l1, but I think the question does too out = [] for idx, val in enumerate(l1): curr = l2[idx] if curr == val or any(val in s for s in out): continue # If this value … Read more