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

Definition:

This method returns the original set as well as non-common items from the compared set. This method changes the original set.

Syntax:

A.update(B)

This method takes a single argument.

Working:

What is update() method in sets

How to use update() method of sets

Code:

  1. Set A is being taken with some random values.
  2. Set B is being taken with some random values.
  3. update() method is being applied on set A with the help of set B
  4. Value of set A is printed

Output:

  1. Set A with its own values and non-common items from set B.

Quick Links:

  1. What is union() method in sets | How to use union() method of sets.
  2. What is symmetric_difference_update() method in sets | How to use symmetric_difference_update() method of sets.

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. Required fields are marked *