Assignment doubt

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
What should be the output?
Why is it different?
How to fix this?

Hey @rohit_1906, try to run this your self, and then be more specific about your question. It seems you haven’t tried it yet.

Happy Learning :blush:

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.