For example, I am given a function that takes in an array to change in place.
def sample(array):
array[-1] = "e"
array = ["a","b","c"]
sample(array[0:2])
print(array)
Ideally, I would like to pass a reference to a subarray (eg.["a","b"]) such that array would also be changed in-place (the output would be ["a","e","c"]).
However, the function outputs
['a', 'b', 'c']
Is there a way to get around this?