Removing an Element from a Set in Python

The discard method can also be used to remove an element from a set. The only difference from the remove method is that it returns the original set rather than an error when the element to be removed is missing.

Let us have a set:

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

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

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

Now let's remove the element 'd':

pythonst.discard('d')
print(st) # {'a', 'b', 'c'}
Задание 1

Given a set:

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

Remove from it the element with value 'y'.

Задание 2

Given a set:

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

Write the code to get the following result:

python{1, 3, 5}
Задание 3

The following code is given:

pythonst = {'ab', 'cd', 'ef'}
st.discard('b')

print(st)

Tell me what will be output to the console.