What is intersection_update() method in sets | How to use intersection_update() method of sets.


This set method is used to remove uncommon items, meaning if we apply this method to set A and B, then the output will be the items which are common to both the sets. Also, this method has no return type so all the changes are done in original set itself. This method takes sets as an argument.

intersectionupdate in python


For two set intersection


For two or more intersection


This method takes an argument


What is intersection_update() method in sets

What is intersection_update() method in sets


  1. Set A is being taken
  2. Set B is being taken
  3. intersection_update() method is being applied in set A with the help of set B
  4. Value of set A is being printed


  1. Set with common item present in both sets is printed as output

Interview Questions

  • What is difference between intersection and intersection update method?

intersection() method gives the output of common items in which are present inside compared sets, this output is printed into another variable. Whereas in intersection_update() method the output is common items which are present inside compared sets, but the output is printed in the original set itself, that is original set is get updated and no other variable is involved here.

Quick Links:

Waqar Khan

Hello, everyone, I am Waqar Khan. I have done my B.tech in Computer Science. I love to write about Computer Informational blogs. Before write I did proper research on it. Hope you like our blogs. Thank you.

Related Posts

Leave a Reply

Your email address will not be published.