I am trying to make a function that is given a nested list, and deletes all occurrences of elements in to_eliminate. I understand why I would have this problem if I did new_list = input_list
, but im doing new_list = input_list[:]
. I even checked their id's and they are definitely different. I don't want to modify my original list.
Both segments of code do not work.
When I return both input_list
and new_list
, I get the same result. I don't understand why, since I copied the original list, and they are two different objects.