DEF the diff (listA, listB): # two ways of intersection of RETA = [I for I in listA IF I in listB] RETB = List (SET (listA) .intersection (SET (listB))) # Print ( "RETA IS: ", RETA) # Print (" RETB IS: ", RETB) # request and set RETC = List (sET (listA) .union (sET (listB))) # Print (" retC1 IS: ", RETC) # differencing set in B but not A, Retd = List (sET (listB) .difference (sET (listA))) Print ( " Retd IS: " , Retd) RETE= [i for i in listB if i not in listA] #print("retE is: ", retE) listA = [1,2,3,4,5] listB = [3,4,5,6,7] diff(listA, listB)