+ 1
why does the function memorize the last return result when I call the same function again?
the sample code(python3): def fuc(x,l=[]): l.append(x) print(l) fuc(1) fuc(1) fuc(1) the result will be: [1] [1,1] [1,1,1] instead of : [1] [1] [1] so why can the func memerize? and what can do to get rid of the memory after the last call?
2 odpowiedzi
+ 11
Here you'll find the answer:
https://code.sololearn.com/cmmVaC1aWcc5/?ref=app