Write a Python program that removes items from set1 that are not common to both set1 and set2


Topic: Write a Python program that removes items from set1 that are not common to both set1 and set2

Solution

set1 = {10, 20, 30, 40, 50}
set2 = {30, 40, 50, 60, 70}
set1.intersection_update(set2)
print(set1)



List all Python Programs