<jupyter_start><jupyter_text>All the IPython Notebooks in this lecture series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes/tree/main/006_Python_Sets_Methods)**  Python Set `pop()`The **`pop()`** method removes an arbitrary element from the set and returns the element removed.**Syntax**:```pythonset.pop()```  `pop()` ParametersThe **`pop()`** method doesn't take any arguments.  Return Value from `pop()`The **`pop()`** method returns an arbitrary (random) element from the set. Also, the set is updated and will not contain the element (which is returned).If the set is empty, **`TypeError`** exception is raised.<jupyter_code># Example 1: How pop() works for Python Sets?

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

print('Return Value is', A.pop())
print('A = ', A)

# When you run the program, we got the following output as below:<jupyter_output>Return Value is c
A =  {'a', 'd', 'b'}<jupyter_text>>**Note:** You may get different output as **`pop()`** returns and removes a random element.<jupyter_code># Example 2: How pop() works for Python Sets?

set1 = {"Welcome", "to", "Python", "course"}
print(set1.pop())
print(set1)<jupyter_output>course
{'Welcome', 'to', 'Python'}
StarcoderdataJupyterStructuredCleanDedup