Python set pop() method
Remove and return an arbitrary item.
Syntax
set.pop()
Sets have no order, so you cannot choose which item. Raises KeyError if the set is empty.
Parameters
None.
Return value
the removed item
Example
Code
s = {10} print(s.pop(), s)
Output
10 set()
Related
Learn it step by step in the free lesson Dictionaries & Sets, with exercises that check your answers.