Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Lists in python are passed by reference. This means that passing a list to a function will change the passed list, rather than creating a "copy" within the function.
If you want to create a new list, then you need to pass a full (deep) copy of the original list to the function, or create such a copy inside the function and perform operations on it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question