- update() is a python function which is update or add new items in the given set.
Syntax-
set.update(list)
-Here list shows the items whicbh are add on the set.
Example
set is {1,2,3}
set.update([4]) will give {1,2,3,4}
program-
s=set([1,2,3])
print("Set is ",s)
s.update([4])
print("Set is",s)
s.update([5,6,"one","two"])
print("Now set is",s)
Set is {1, 2, 3}
Set is {1, 2, 3, 4}
Now set is {1, 2, 3, 4, 5, 6, 'one', 'two'}