0
mutable set member function?
Hello, I got this question Which of these is a mutable set member function? a) remove() b)extend() c)del() d)append() I am not sure how this applies in real life scenario? to me whenever you perform remove,extend,del and append will change the set so why only remove is correct?
3 Answers
+ 3
Hi !
extend() adds one list's value in the END of the list, and order is saved, that's why you can't use it in set (sets are unordered).
append() is the same, but it adds one element, again, to the END of the list.
del() removes some element from the list by it's index, sets can't be indexed (unordered).
remove() removes some element from a sequence, that's why you can use it in sets, you don't need the order of sequence to remove from it any element.
+ 1
I edited, check it out, truly forgot :)
0
how about del?