set.pop() - Removes and returns a random element from the set

PHOTO EMBED

Tue Jun 18 2024 03:03:04 GMT+0000 (Coordinated Universal Time)

Saved by @pynerds #python

myset = {1, 3, 5, 7, 9, 11}

#remove an arbitrary element
print(myset.pop())
print(myset.pop())
print(myset.pop())
print(myset.pop())

print(myset)
content_copyCOPY

https://www.pynerds.com/set-pop-method-in-python/