Removing elements from lists (return)


del(n[1]) is like .pop in that it will remove the item at the given index, but it won't return it:

what does it mean that it won't return it? why do I need the index from a item returned?
what does returned mean then?


If you want to process the last value of a list and remove it at the same time, you can use list.pop

del is a statement so it has no result/return value, it just has the side effect that something is removed


A post was split to a new topic: Question about return