set.pop() in python



set is an unordered collection. Hence while using "pop()" function it will remove any element in the set.




Syntax:




set.pop()







Example-1
n = {10, 20, 30, 50, 60}

n.pop()

print(n)


Output



{50, 20, 60, 30}







Example-2
n = {10, 20, 30, 40, 50}

n.pop()

print(n)


Output



{10, 50, 20, 30}







Example-3
n = {"A", "B", "C", "D", "E"}

n.pop()

print(n)


Output



{'E', 'D', 'C', 'A'}