method pop from set | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

method pop from set

when I use pop to remove arbitrary element from set, why it always remove the first element?

1st Oct 2016, 9:13 AM
runner
1 Answer
0
It may be that the first element is the first in memory, thus when you do set.pop(), it just gives you the first element. Other than that, I don't think using pop on sets is that useful, but I may be wrong
9th Oct 2016, 10:02 PM
Amaras A
Amaras A - avatar