0

How to implement a function which modify a list using list slicing and yet does not return a value

15th Mar 2020, 3:29 AM
Tan
2 Réponses
+ 1
Here is an example what you are asking to do. This is, however, not necessarily a good practice, because your function modifies global state (a list that is outside the scope of the function). This makes your function 'impure'. If you are not careful, in more complex programs this can lead to bugs that are very difficult to find. I suggest to read more about pure functions, side effects, why mutable global state is bad. https://en.m.wikipedia.org/wiki/Pure_function https://code.sololearn.com/cDoSqOKgGY5n/?ref=app
15th Mar 2020, 10:14 AM
Tibor Santa
Tibor Santa - avatar