I'm trying to call a function recursively, and passing parts of the list to the function.
def op3(c,i):
d = []
for l in range(0,len(c),+1):
d.append(c[l])
a, b = [], []
if len(d)>=3:
for l in range(1,len(d)-1,+1):
a.append(d[l])
for l in range(2,len(d),+1):
b.append(d[l])
A,B = [],[]
for j in range(0,len(a),+1):
a[j][i] = a[j][i]+a[j][i+1]
a[j].pop(i+1)
insertf(a,final)
A.append(a[j])
op3(A,i+1)
for k in range(0,len(b),+1):
b[k][i+1] = b[k][i+1]+b[k][i+2]
b[k].pop(i+2)
insertf(b,final)
B.append(b[k])
op3(B,i+1)
but the values in the original list are changed in list 'b' to the new values of d after the first nested 'for' loop runs. i'm fairly new to python. i have read that this is just how lists work in python. is there a way around this?
tuple? OrnewList=copy.deepcopy(otherList)to create a completely separate list?