Write Python code t get difference of two lists Using set()


Topic: Write Python code t get difference of two lists Using set()

Solution

def Diff(li1, li2):
	return (list(list(set(li1)-set(li2)) + list(set(li2)-set(li1))))
li1 = [10, 15, 20, 25, 30, 35, 40]
li2 = [25, 40, 35]
print(Diff(li1, li2))



List all Python Programs