It appears (to me) that returning and removing something is the same thing, but I am assuming that because there are two different ways to do them that they have different functions that I’m not picking up on.
1.pop(index) will remove the item at index from the list and return it to you:
n = [1, 3, 5] n.pop(1) # Returns 3 (the item at index 1) print n # prints [1, 5]
- del(n) is like .pop in that it will remove the item at the given index, but it won’t return it:
del(n) # Doesn't return anything print n # prints [1, 5]