def check(val, list=[]):
list.append(val)
return list
list1=check("a")
list2=check("b",[])
list3=check("c")
If I run list1
and check the output it shows ["a"]
But, If I run list1
, list2
and list3
in one
cell and check for list1 it shows ['a','c']
, can someone please explain why is it so?