One of my function appends an item to the list. This appended list is then sent as argument into two recursive function. But when one of the called function updates its own local list, the original list gets modified because of which second recursive function gets modified list as input. Basically this is a sort of thing that i am trying to do. Here i want [2] [2,3] [2,4] as output but i am getting [2][2,3] as only output as the original list is getting modified. Is there any way that i can send same list in two functions.
def Growtree(llst, x):
if len(llst) == 2:
return
llst.append(x)
print(llst)
Growtree(llst,3)
Growtree(llst,4)