+ 5
[SOLVED] Please explain the outputs (I know the difference between a=a+b and a+=b in lists) :-
def f(a,l=[]): l+=[a] return l print(f(2),f(3)) #Output: [2, 3] [2, 3] def f(a,l=[]): l=l+[a] return l print(f(2),f(3)) #Output: [2] [3]
2 Antworten
+ 8
Here is my comment on this question. it is too much text to post it direct.
https://code.sololearn.com/cIUOZJn559r3/?ref=app
+ 3
See if this helps.
https://www.sololearn.com/Discuss/2338606/?ref=app