Home >>Python Set Methods >Python Set update() Method
Python set update() method is used to update the current set by adding items to it from the another set. If an item is present in both sets then only one appearance of this item will be present in the updated set.
Syntax:set.update(set)
Parameter | Description |
---|---|
set | This is a required parameter. It defines the set insert into the current set. |
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
x.update(y)
print(x)
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
y.update(x)
print(y)