In this example we will show how to add more than one item to a set using the update() method in Python.
Source Code
my_set = {'a', 'b', 1, 'c'}
my_set.update([2, 'd', 3])
print(my_set)
Output:
{1, 2, 3, 'a', 'c', 'd', 'b'}
In this example we will show how to add more than one item to a set using the update() method in Python.
my_set = {'a', 'b', 1, 'c'}
my_set.update([2, 'd', 3])
print(my_set)
Output:
{1, 2, 3, 'a', 'c', 'd', 'b'}