Python's slice operation creates a copy of a specified portion a list. How do I pass a slice of a parent list so that when this slice changes, the corresponding portion of the parent list changes with it?
def modify(input):
input[0] = 4
input[1] = 5
input[2] = 6
list = [1,2,3,1,2,3]
modify(list[3:6])
print("Woud like to have: [1,2,3,4,5,6]")
print("But I got: " + str(list))
Output:
Would like to have: [1,2,3,4,5,6]
But I got: [1,2,3,1,2,3]