def fun(x, a=[]): a.append(x) print (a)
fun(3) fun(5) fun([7,8]) fun({7,8})
o/p: [3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
1 | initial version |
def fun(x, a=[]): a.append(x) print (a)
fun(3) fun(5) fun([7,8]) fun({7,8})
o/p: [3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a=[]): a.append(x) print (a)
fun(3)
fun(5)
fun([7,8])
o/p:
o/p:
[3]
[3, 5]
[3, 5, [7, 8]]
[3, 5, [7, 8], {8, 7}]
def fun(x, a=[]): a.append(x) print (a)
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a=[]): a.append(x) print (a)
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a=[]):
a=[]):
a.append(x)
print (a)(a)
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a=[]):
a.append(x)
print (a)
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a=[]):
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a= []):
a.append(x)
print (a)
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, a= []): b= []):
a.append(x)
... b.append(x)
print (a) ... print(x,' ',b)
...
fun(7)
7 [7]
fun([9, 7])
[9, 7] [7, [9, 7]]
fun([9, 8])
[9, 8] [7, [9, 7], [9, 8]]
fun(3)
fun(5)
fun([7,8])
fun({7,8})
o/p:
[3] [3, 5] [3, 5, [7, 8]] [3, 5, [7, 8], {8, 7}]
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9, 8]]
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9, 8]]
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9, 8]]
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9, 8]]
![>>> def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ...
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ...fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9,8]]8]] ](http://)
![>>> def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ...
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9,
8]] ](http://)8]]
def fun(x, b= []): ... b.append(x) ... print(x,' ',b) ... fun(7) 7 [7] fun([9, 7]) [9, 7] [7, [9, 7]] fun([9, 8]) [9, 8] [7, [9, 7], [9, 8]]
.
>>>
def fun(x, b= []):