I have found out that I can change a list values in a function, I thought functions only passed down the values of the parameters and not the list itself, how can i overcome this problem?
def change_list(lists):
lists[0] = 100
a = [1,2,3]
print(a)
[1,2,3]
change_list(a)
print(a)
[100,2,3]
but it doesn't change the values of the list if I change the whole list altogether.
def change_list(lists):
lists = [4,5,6]
a = [1,2,3]
print(a)
[1,2,3]
change_list(a)
print(a)
[1,2,3]