Adding Multiple Elements to a Set in Python

The add method can be used to add elements to a set one by one. But when you need to add several elements at once, the update method is used.

Let us have a set:

pythonst = {'a', 'b', 'c', 'd'}

If you pass a string to the method, it will be added to the set as a list of elements. Let's add the string 'xyz' to the set:

pythonst.update('xyz')
print(st) # {'z', 'y', 'd', 'c', 'x', 'a', 'b'}

In the parameter of the update method, you can specify lists to add to the set:

pythonst.update(['1', '2', '3'])
print(st) # {'1', 'b', 'a', 'd', 'c', '3', '2'}

Elements of tuples can also be added to a set:

pythonst.update((1, 2, 3))
print(st) # {'a', 'c', 1, 2, 3, 'd', 'b'}

But when passing dictionaries to a set, only its keys will be added:

pythonst.update({1: 'text1', 2: 'text2'})
print(st) # {1, 'd', 2, 'a', 'b', 'c'}
Задание 1

Given a set:

pythonst = {'x', 'y', 'z', 'w'}

Add to it the line 'abxcz'.

Задание 2

Given a set:

pythonst = {1, 2, 3}

The list is also given:

pythonlst = [3, 4, 5, 6]

Add the list items to our set.

Задание 3

The following code is given:

pythonst = {'12', '34', '56'}
tlp = (2, 4, 6)

st.update(tlp)
print(st)

Tell me what will be output to the console.