Program - Given a two sets find the intersection and remove those elements from the first set


Topic: Program - Given a two sets find the intersection and remove those elements from the first set

Solution

firstSet  = {23, 42, 65, 57, 78, 83, 29}
secondSet = {57, 83, 29, 67, 73, 43, 48}
intersection = firstSet.intersection(secondSet)
for item in intersection:
  firstSet.remove(item)
print("First Set after removing common element ", firstSet)



List all Python Programs