Why function retains values of arguments when i recall this function at the second time?
def distribution_of(golds, l1=[], l2=[]): l1 is [] l2 is [] #print(golds) #print(l1) #print(l2) if len(golds) > 0: if len(l2) - len(l1) == 0 or len(l2) - len(l1) == 1: l1 == l1.append(max(golds[0],golds[-1])) golds == golds.remove(max(golds[0],golds[-1])) return distribution_of(golds) else: l2 == l2.append(max(golds[0],golds[-1])) golds == golds.remove(max(golds[0],golds[-1])) return distribution_of(golds) return [sum(l1), sum(l2)] print(distribution_of([4,7,2,9,5,2]))#expacted result is [11,18] print(distribution_of([10,1000,2,1]))#expacted result is [12,1001], but I get the sum of the previous result of the function and current. Why? What i passed?