Removing an Element from a Set in Python

To remove an element from a set, you can use the remove method. We pass the desired element to its parameter.

Let us have a set:

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

Let's remove the element 'a' from it:

pythonst.remove('a')
print(st) # {'b', 'c'}

If the element to be removed is not in the set, an error will be returned:

pythonst.remove('d')
print(st) # will display an error
Задание 1

Given a set:

pythonst = {1, 2, 3, 4, 5}

Remove from it the element with value 3.

Задание 2

The following code is given:

pythonst = {'12', 1, '34', 2, '56'}
st.remove('1')

print(st)

Tell me what will be output to the console.

Задание 3

The following code is given:

pythonst = {1, 7, '2', 14, 5, 2}
st.remove(2)

print(st)

Tell me what will be output to the console.