L1 = [11, 22, 33,'a', 'b',(1,2,3)] L2 = [33,'b','c',55,22,(1,2,3)] # find out the list with the same elements # L3 = [] # for i in L1: # if i in L2: # L3.append(i) # print(L3) # find out the elements in L1 but not in L2 # L3 = [] # for i in L1: # if i not in L2: # L3.append(i) # print(L3) # find out the elements in L2 but not in L1 # L3 = [] # for i in L2: # if i not in L1: # L3.append(i) # print(L3) # find out the elements (in L1 but not in L2) and (not in L1 but in L2) L3 = [] for i in L2: if i not in L1: L3.append(i) for i in L1: if i not in L2: L3.append(i) print(L3)