混淆代码--面试题
作者:互联网
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) def extendList(val, list=None): if list is None: 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)
标签:混淆,面试题,list,代码,list1,extendList,list3,list2,print 来源: https://www.cnblogs.com/renguiyouzhi/p/12033167.html