0
How to implement a function which modify a list using list slicing and yet does not return a value
2 ответов
+ 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