0

Can some one help me in understanding below code python lists

list1 = [] list2 = [] list3 = [] def extendlist(val,list=[]): list.append(val) return list list1 = extendlist(10) list2 = extendlist(123,[]) list3 = extendlist('a') print("list1 = %s" % list1) print("list2 = %s" % list2) print("list3 = %s" % list3)

2nd Nov 2020, 5:43 PM
Akhila Manchala
Akhila Manchala - avatar
1 ответ
0
You have defined 3 empty lists: list1,list2 and list3. Than you have defined a function for appendind value to empty list
2nd Nov 2020, 7:32 PM
Václav Dostál
Václav Dostál - avatar