0
What's thedifference between pop(), del, clear() function?
3 Antworten
+ 2
pop removes and returns the last value of the list or the given index value.
del removes the given index value.
clear clears the whole list.
And you didn't ask for it, but remove removes the first occurence of a given value.
+ 1
If you want to use the element you are removing, use pop, otherwise use del.
0
Zen Am I free to choose between pop and del? Like, is there any situation where pop will apply but not del and vice versa.!!?